mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-30 08:37:12 +08:00
- ent/schema: host, virtualmachine, teamhost, teamgrouphost - 修改 user/team/teamgroup/model schema 添加 host/vm edges - migration/000003: hosts, virtualmachines, team_hosts, team_group_hosts 建表
370 lines
15 KiB
Go
370 lines
15 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package teamgroup
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the teamgroup type in the database.
|
|
Label = "team_group"
|
|
// 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"
|
|
// FieldTeamID holds the string denoting the team_id field in the database.
|
|
FieldTeamID = "team_id"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// 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"
|
|
// EdgeMembers holds the string denoting the members edge name in mutations.
|
|
EdgeMembers = "members"
|
|
// EdgeTeam holds the string denoting the team edge name in mutations.
|
|
EdgeTeam = "team"
|
|
// EdgeModels holds the string denoting the models edge name in mutations.
|
|
EdgeModels = "models"
|
|
// EdgeImages holds the string denoting the images edge name in mutations.
|
|
EdgeImages = "images"
|
|
// EdgeHosts holds the string denoting the hosts edge name in mutations.
|
|
EdgeHosts = "hosts"
|
|
// EdgeTeamGroupMembers holds the string denoting the team_group_members edge name in mutations.
|
|
EdgeTeamGroupMembers = "team_group_members"
|
|
// EdgeTeamGroupModels holds the string denoting the team_group_models edge name in mutations.
|
|
EdgeTeamGroupModels = "team_group_models"
|
|
// EdgeTeamGroupImages holds the string denoting the team_group_images edge name in mutations.
|
|
EdgeTeamGroupImages = "team_group_images"
|
|
// EdgeTeamGroupHosts holds the string denoting the team_group_hosts edge name in mutations.
|
|
EdgeTeamGroupHosts = "team_group_hosts"
|
|
// Table holds the table name of the teamgroup in the database.
|
|
Table = "team_groups"
|
|
// MembersTable is the table that holds the members relation/edge. The primary key declared below.
|
|
MembersTable = "team_group_members"
|
|
// MembersInverseTable is the table name for the User entity.
|
|
// It exists in this package in order to avoid circular dependency with the "user" package.
|
|
MembersInverseTable = "users"
|
|
// TeamTable is the table that holds the team relation/edge.
|
|
TeamTable = "team_groups"
|
|
// TeamInverseTable is the table name for the Team entity.
|
|
// It exists in this package in order to avoid circular dependency with the "team" package.
|
|
TeamInverseTable = "teams"
|
|
// TeamColumn is the table column denoting the team relation/edge.
|
|
TeamColumn = "team_id"
|
|
// ModelsTable is the table that holds the models relation/edge. The primary key declared below.
|
|
ModelsTable = "team_group_models"
|
|
// ModelsInverseTable is the table name for the Model entity.
|
|
// It exists in this package in order to avoid circular dependency with the "model" package.
|
|
ModelsInverseTable = "models"
|
|
// ImagesTable is the table that holds the images relation/edge. The primary key declared below.
|
|
ImagesTable = "team_group_images"
|
|
// ImagesInverseTable is the table name for the Image entity.
|
|
// It exists in this package in order to avoid circular dependency with the "image" package.
|
|
ImagesInverseTable = "images"
|
|
// HostsTable is the table that holds the hosts relation/edge. The primary key declared below.
|
|
HostsTable = "team_group_hosts"
|
|
// HostsInverseTable is the table name for the Host entity.
|
|
// It exists in this package in order to avoid circular dependency with the "host" package.
|
|
HostsInverseTable = "hosts"
|
|
// TeamGroupMembersTable is the table that holds the team_group_members relation/edge.
|
|
TeamGroupMembersTable = "team_group_members"
|
|
// TeamGroupMembersInverseTable is the table name for the TeamGroupMember entity.
|
|
// It exists in this package in order to avoid circular dependency with the "teamgroupmember" package.
|
|
TeamGroupMembersInverseTable = "team_group_members"
|
|
// TeamGroupMembersColumn is the table column denoting the team_group_members relation/edge.
|
|
TeamGroupMembersColumn = "group_id"
|
|
// TeamGroupModelsTable is the table that holds the team_group_models relation/edge.
|
|
TeamGroupModelsTable = "team_group_models"
|
|
// TeamGroupModelsInverseTable is the table name for the TeamGroupModel entity.
|
|
// It exists in this package in order to avoid circular dependency with the "teamgroupmodel" package.
|
|
TeamGroupModelsInverseTable = "team_group_models"
|
|
// TeamGroupModelsColumn is the table column denoting the team_group_models relation/edge.
|
|
TeamGroupModelsColumn = "group_id"
|
|
// TeamGroupImagesTable is the table that holds the team_group_images relation/edge.
|
|
TeamGroupImagesTable = "team_group_images"
|
|
// TeamGroupImagesInverseTable is the table name for the TeamGroupImage entity.
|
|
// It exists in this package in order to avoid circular dependency with the "teamgroupimage" package.
|
|
TeamGroupImagesInverseTable = "team_group_images"
|
|
// TeamGroupImagesColumn is the table column denoting the team_group_images relation/edge.
|
|
TeamGroupImagesColumn = "group_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 = "group_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for teamgroup fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldDeletedAt,
|
|
FieldTeamID,
|
|
FieldName,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
var (
|
|
// MembersPrimaryKey and MembersColumn2 are the table columns denoting the
|
|
// primary key for the members relation (M2M).
|
|
MembersPrimaryKey = []string{"user_id", "group_id"}
|
|
// ModelsPrimaryKey and ModelsColumn2 are the table columns denoting the
|
|
// primary key for the models relation (M2M).
|
|
ModelsPrimaryKey = []string{"group_id", "model_id"}
|
|
// ImagesPrimaryKey and ImagesColumn2 are the table columns denoting the
|
|
// primary key for the images relation (M2M).
|
|
ImagesPrimaryKey = []string{"group_id", "image_id"}
|
|
// HostsPrimaryKey and HostsColumn2 are the table columns denoting the
|
|
// primary key for the hosts relation (M2M).
|
|
HostsPrimaryKey = []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
|
|
// 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 TeamGroup 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()
|
|
}
|
|
|
|
// ByTeamID orders the results by the team_id field.
|
|
func ByTeamID(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTeamID, opts...).ToFunc()
|
|
}
|
|
|
|
// ByName orders the results by the name field.
|
|
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldName, 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()
|
|
}
|
|
|
|
// ByMembersCount orders the results by members count.
|
|
func ByMembersCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newMembersStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByMembers orders the results by members terms.
|
|
func ByMembers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newMembersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByTeamField orders the results by team field.
|
|
func ByTeamField(field string, opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamStep(), sql.OrderByField(field, opts...))
|
|
}
|
|
}
|
|
|
|
// ByModelsCount orders the results by models count.
|
|
func ByModelsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newModelsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByModels orders the results by models terms.
|
|
func ByModels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newModelsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByImagesCount orders the results by images count.
|
|
func ByImagesCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newImagesStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByImages orders the results by images terms.
|
|
func ByImages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newImagesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByHostsCount orders the results by hosts count.
|
|
func ByHostsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newHostsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByHosts orders the results by hosts terms.
|
|
func ByHosts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newHostsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupMembersCount orders the results by team_group_members count.
|
|
func ByTeamGroupMembersCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newTeamGroupMembersStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupMembers orders the results by team_group_members terms.
|
|
func ByTeamGroupMembers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamGroupMembersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupModelsCount orders the results by team_group_models count.
|
|
func ByTeamGroupModelsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newTeamGroupModelsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupModels orders the results by team_group_models terms.
|
|
func ByTeamGroupModels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamGroupModelsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupImagesCount orders the results by team_group_images count.
|
|
func ByTeamGroupImagesCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newTeamGroupImagesStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByTeamGroupImages orders the results by team_group_images terms.
|
|
func ByTeamGroupImages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamGroupImagesStep(), 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 newMembersStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(MembersInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, MembersTable, MembersPrimaryKey...),
|
|
)
|
|
}
|
|
func newTeamStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, TeamTable, TeamColumn),
|
|
)
|
|
}
|
|
func newModelsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ModelsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, ModelsTable, ModelsPrimaryKey...),
|
|
)
|
|
}
|
|
func newImagesStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ImagesInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, ImagesTable, ImagesPrimaryKey...),
|
|
)
|
|
}
|
|
func newHostsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(HostsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, false, HostsTable, HostsPrimaryKey...),
|
|
)
|
|
}
|
|
func newTeamGroupMembersStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamGroupMembersInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamGroupMembersTable, TeamGroupMembersColumn),
|
|
)
|
|
}
|
|
func newTeamGroupModelsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamGroupModelsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamGroupModelsTable, TeamGroupModelsColumn),
|
|
)
|
|
}
|
|
func newTeamGroupImagesStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamGroupImagesInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamGroupImagesTable, TeamGroupImagesColumn),
|
|
)
|
|
}
|
|
func newTeamGroupHostsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamGroupHostsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamGroupHostsTable, TeamGroupHostsColumn),
|
|
)
|
|
}
|