mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 19:39:31 +08:00
- 新增 git_bots, git_bot_users, git_bot_tasks, project_git_bots 表 - 添加 user, host, project 到 gitbot 的关联边 - 使用 soft delete 和 created_at 游标
337 lines
12 KiB
Go
337 lines
12 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package host
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the host type in the database.
|
|
Label = "host"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
|
|
FieldDeletedAt = "deleted_at"
|
|
// FieldUserID holds the string denoting the user_id field in the database.
|
|
FieldUserID = "user_id"
|
|
// FieldHostname holds the string denoting the hostname field in the database.
|
|
FieldHostname = "hostname"
|
|
// FieldArch holds the string denoting the arch field in the database.
|
|
FieldArch = "arch"
|
|
// FieldCores holds the string denoting the cores field in the database.
|
|
FieldCores = "cores"
|
|
// FieldWeight holds the string denoting the weight field in the database.
|
|
FieldWeight = "weight"
|
|
// FieldMemory holds the string denoting the memory field in the database.
|
|
FieldMemory = "memory"
|
|
// FieldDisk holds the string denoting the disk field in the database.
|
|
FieldDisk = "disk"
|
|
// FieldOs holds the string denoting the os field in the database.
|
|
FieldOs = "os"
|
|
// FieldExternalIP holds the string denoting the external_ip field in the database.
|
|
FieldExternalIP = "external_ip"
|
|
// FieldInternalIP holds the string denoting the internal_ip field in the database.
|
|
FieldInternalIP = "internal_ip"
|
|
// FieldVersion holds the string denoting the version field in the database.
|
|
FieldVersion = "version"
|
|
// FieldMachineID holds the string denoting the machine_id field in the database.
|
|
FieldMachineID = "machine_id"
|
|
// FieldRemark holds the string denoting the remark field in the database.
|
|
FieldRemark = "remark"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
|
FieldUpdatedAt = "updated_at"
|
|
// EdgeVms holds the string denoting the vms edge name in mutations.
|
|
EdgeVms = "vms"
|
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
|
EdgeUser = "user"
|
|
// EdgeGroups holds the string denoting the groups edge name in mutations.
|
|
EdgeGroups = "groups"
|
|
// EdgeGitBots holds the string denoting the git_bots edge name in mutations.
|
|
EdgeGitBots = "git_bots"
|
|
// EdgeTeamGroupHosts holds the string denoting the team_group_hosts edge name in mutations.
|
|
EdgeTeamGroupHosts = "team_group_hosts"
|
|
// Table holds the table name of the host in the database.
|
|
Table = "hosts"
|
|
// VmsTable is the table that holds the vms relation/edge.
|
|
VmsTable = "virtualmachines"
|
|
// VmsInverseTable is the table name for the VirtualMachine entity.
|
|
// It exists in this package in order to avoid circular dependency with the "virtualmachine" package.
|
|
VmsInverseTable = "virtualmachines"
|
|
// VmsColumn is the table column denoting the vms relation/edge.
|
|
VmsColumn = "host_id"
|
|
// UserTable is the table that holds the user relation/edge.
|
|
UserTable = "hosts"
|
|
// UserInverseTable is the table name for the User entity.
|
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
|
UserInverseTable = "users"
|
|
// UserColumn is the table column denoting the user relation/edge.
|
|
UserColumn = "user_id"
|
|
// GroupsTable is the table that holds the groups relation/edge. The primary key declared below.
|
|
GroupsTable = "team_group_hosts"
|
|
// GroupsInverseTable is the table name for the TeamGroup entity.
|
|
// It exists in this package in order to avoid circular dependency with the "teamgroup" package.
|
|
GroupsInverseTable = "team_groups"
|
|
// GitBotsTable is the table that holds the git_bots relation/edge.
|
|
GitBotsTable = "git_bots"
|
|
// GitBotsInverseTable is the table name for the GitBot entity.
|
|
// It exists in this package in order to avoid circular dependency with the "gitbot" package.
|
|
GitBotsInverseTable = "git_bots"
|
|
// GitBotsColumn is the table column denoting the git_bots relation/edge.
|
|
GitBotsColumn = "host_id"
|
|
// TeamGroupHostsTable is the table that holds the team_group_hosts relation/edge.
|
|
TeamGroupHostsTable = "team_group_hosts"
|
|
// TeamGroupHostsInverseTable is the table name for the TeamGroupHost entity.
|
|
// It exists in this package in order to avoid circular dependency with the "teamgrouphost" package.
|
|
TeamGroupHostsInverseTable = "team_group_hosts"
|
|
// TeamGroupHostsColumn is the table column denoting the team_group_hosts relation/edge.
|
|
TeamGroupHostsColumn = "host_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for host fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldDeletedAt,
|
|
FieldUserID,
|
|
FieldHostname,
|
|
FieldArch,
|
|
FieldCores,
|
|
FieldWeight,
|
|
FieldMemory,
|
|
FieldDisk,
|
|
FieldOs,
|
|
FieldExternalIP,
|
|
FieldInternalIP,
|
|
FieldVersion,
|
|
FieldMachineID,
|
|
FieldRemark,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
var (
|
|
// GroupsPrimaryKey and GroupsColumn2 are the table columns denoting the
|
|
// primary key for the groups relation (M2M).
|
|
GroupsPrimaryKey = []string{"group_id", "host_id"}
|
|
)
|
|
|
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
|
func ValidColumn(column string) bool {
|
|
for i := range Columns {
|
|
if column == Columns[i] {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Note that the variables below are initialized by the runtime
|
|
// package on the initialization of the application. Therefore,
|
|
// it should be imported in the main as follows:
|
|
//
|
|
// import _ "github.com/chaitin/MonkeyCode/backend/db/runtime"
|
|
var (
|
|
Hooks [1]ent.Hook
|
|
Interceptors [1]ent.Interceptor
|
|
// DefaultWeight holds the default value on creation for the "weight" field.
|
|
DefaultWeight int
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() time.Time
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() time.Time
|
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
|
UpdateDefaultUpdatedAt func() time.Time
|
|
)
|
|
|
|
// OrderOption defines the ordering options for the Host queries.
|
|
type OrderOption func(*sql.Selector)
|
|
|
|
// ByID orders the results by the id field.
|
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDeletedAt orders the results by the deleted_at field.
|
|
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUserID orders the results by the user_id field.
|
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByHostname orders the results by the hostname field.
|
|
func ByHostname(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldHostname, opts...).ToFunc()
|
|
}
|
|
|
|
// ByArch orders the results by the arch field.
|
|
func ByArch(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldArch, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCores orders the results by the cores field.
|
|
func ByCores(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCores, opts...).ToFunc()
|
|
}
|
|
|
|
// ByWeight orders the results by the weight field.
|
|
func ByWeight(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldWeight, opts...).ToFunc()
|
|
}
|
|
|
|
// ByMemory orders the results by the memory field.
|
|
func ByMemory(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldMemory, opts...).ToFunc()
|
|
}
|
|
|
|
// ByDisk orders the results by the disk field.
|
|
func ByDisk(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldDisk, opts...).ToFunc()
|
|
}
|
|
|
|
// ByOs orders the results by the os field.
|
|
func ByOs(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldOs, opts...).ToFunc()
|
|
}
|
|
|
|
// ByExternalIP orders the results by the external_ip field.
|
|
func ByExternalIP(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldExternalIP, opts...).ToFunc()
|
|
}
|
|
|
|
// ByInternalIP orders the results by the internal_ip field.
|
|
func ByInternalIP(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldInternalIP, opts...).ToFunc()
|
|
}
|
|
|
|
// ByVersion orders the results by the version field.
|
|
func ByVersion(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldVersion, opts...).ToFunc()
|
|
}
|
|
|
|
// ByMachineID orders the results by the machine_id field.
|
|
func ByMachineID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldMachineID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByRemark orders the results by the remark field.
|
|
func ByRemark(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldRemark, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByVmsCount orders the results by vms count.
|
|
func ByVmsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newVmsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByVms orders the results by vms terms.
|
|
func ByVms(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newVmsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByUserField orders the results by user field.
|
|
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByGroupsCount orders the results by groups count.
|
|
func ByGroupsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newGroupsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByGroups orders the results by groups terms.
|
|
func ByGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByGitBotsCount orders the results by git_bots count.
|
|
func ByGitBotsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newGitBotsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByGitBots orders the results by git_bots terms.
|
|
func ByGitBots(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newGitBotsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupHostsCount orders the results by team_group_hosts count.
|
|
func ByTeamGroupHostsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newTeamGroupHostsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupHosts orders the results by team_group_hosts terms.
|
|
func ByTeamGroupHosts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamGroupHostsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
func newVmsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(VmsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, VmsTable, VmsColumn),
|
|
)
|
|
}
|
|
func newUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(UserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
)
|
|
}
|
|
func newGroupsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(GroupsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, GroupsTable, GroupsPrimaryKey...),
|
|
)
|
|
}
|
|
func newGitBotsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(GitBotsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, GitBotsTable, GitBotsColumn),
|
|
)
|
|
}
|
|
func newTeamGroupHostsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamGroupHostsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamGroupHostsTable, TeamGroupHostsColumn),
|
|
)
|
|
}
|