mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 19:39:31 +08:00
398 lines
15 KiB
Go
398 lines
15 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the model type in the database.
|
|
Label = "model"
|
|
// 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"
|
|
// FieldProvider holds the string denoting the provider field in the database.
|
|
FieldProvider = "provider"
|
|
// FieldAPIKey holds the string denoting the api_key field in the database.
|
|
FieldAPIKey = "api_key"
|
|
// FieldBaseURL holds the string denoting the base_url field in the database.
|
|
FieldBaseURL = "base_url"
|
|
// FieldModel holds the string denoting the model field in the database.
|
|
FieldModel = "model"
|
|
// FieldRemark holds the string denoting the remark field in the database.
|
|
FieldRemark = "remark"
|
|
// FieldTemperature holds the string denoting the temperature field in the database.
|
|
FieldTemperature = "temperature"
|
|
// FieldInterfaceType holds the string denoting the interface_type field in the database.
|
|
FieldInterfaceType = "interface_type"
|
|
// FieldWeight holds the string denoting the weight field in the database.
|
|
FieldWeight = "weight"
|
|
// FieldLastCheckAt holds the string denoting the last_check_at field in the database.
|
|
FieldLastCheckAt = "last_check_at"
|
|
// FieldLastCheckSuccess holds the string denoting the last_check_success field in the database.
|
|
FieldLastCheckSuccess = "last_check_success"
|
|
// FieldLastCheckError holds the string denoting the last_check_error field in the database.
|
|
FieldLastCheckError = "last_check_error"
|
|
// 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"
|
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
|
EdgeUser = "user"
|
|
// EdgeTeams holds the string denoting the teams edge name in mutations.
|
|
EdgeTeams = "teams"
|
|
// EdgeGroups holds the string denoting the groups edge name in mutations.
|
|
EdgeGroups = "groups"
|
|
// EdgeVms holds the string denoting the vms edge name in mutations.
|
|
EdgeVms = "vms"
|
|
// EdgeProjectTasks holds the string denoting the project_tasks edge name in mutations.
|
|
EdgeProjectTasks = "project_tasks"
|
|
// EdgeTeamModels holds the string denoting the team_models edge name in mutations.
|
|
EdgeTeamModels = "team_models"
|
|
// EdgeTeamGroupModels holds the string denoting the team_group_models edge name in mutations.
|
|
EdgeTeamGroupModels = "team_group_models"
|
|
// Table holds the table name of the model in the database.
|
|
Table = "models"
|
|
// UserTable is the table that holds the user relation/edge.
|
|
UserTable = "models"
|
|
// 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"
|
|
// TeamsTable is the table that holds the teams relation/edge. The primary key declared below.
|
|
TeamsTable = "team_models"
|
|
// TeamsInverseTable is the table name for the Team entity.
|
|
// It exists in this package in order to avoid circular dependency with the "team" package.
|
|
TeamsInverseTable = "teams"
|
|
// GroupsTable is the table that holds the groups relation/edge. The primary key declared below.
|
|
GroupsTable = "team_group_models"
|
|
// 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"
|
|
// 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 = "model_id"
|
|
// ProjectTasksTable is the table that holds the project_tasks relation/edge.
|
|
ProjectTasksTable = "project_tasks"
|
|
// ProjectTasksInverseTable is the table name for the ProjectTask entity.
|
|
// It exists in this package in order to avoid circular dependency with the "projecttask" package.
|
|
ProjectTasksInverseTable = "project_tasks"
|
|
// ProjectTasksColumn is the table column denoting the project_tasks relation/edge.
|
|
ProjectTasksColumn = "model_id"
|
|
// TeamModelsTable is the table that holds the team_models relation/edge.
|
|
TeamModelsTable = "team_models"
|
|
// TeamModelsInverseTable is the table name for the TeamModel entity.
|
|
// It exists in this package in order to avoid circular dependency with the "teammodel" package.
|
|
TeamModelsInverseTable = "team_models"
|
|
// TeamModelsColumn is the table column denoting the team_models relation/edge.
|
|
TeamModelsColumn = "model_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 = "model_id"
|
|
)
|
|
|
|
// Columns holds all SQL columns for model fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldDeletedAt,
|
|
FieldUserID,
|
|
FieldProvider,
|
|
FieldAPIKey,
|
|
FieldBaseURL,
|
|
FieldModel,
|
|
FieldRemark,
|
|
FieldTemperature,
|
|
FieldInterfaceType,
|
|
FieldWeight,
|
|
FieldLastCheckAt,
|
|
FieldLastCheckSuccess,
|
|
FieldLastCheckError,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
}
|
|
|
|
var (
|
|
// TeamsPrimaryKey and TeamsColumn2 are the table columns denoting the
|
|
// primary key for the teams relation (M2M).
|
|
TeamsPrimaryKey = []string{"team_id", "model_id"}
|
|
// GroupsPrimaryKey and GroupsColumn2 are the table columns denoting the
|
|
// primary key for the groups relation (M2M).
|
|
GroupsPrimaryKey = []string{"group_id", "model_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
|
|
// ProviderValidator is a validator for the "provider" field. It is called by the builders before save.
|
|
ProviderValidator func(string) error
|
|
// APIKeyValidator is a validator for the "api_key" field. It is called by the builders before save.
|
|
APIKeyValidator func(string) error
|
|
// BaseURLValidator is a validator for the "base_url" field. It is called by the builders before save.
|
|
BaseURLValidator func(string) error
|
|
// ModelValidator is a validator for the "model" field. It is called by the builders before save.
|
|
ModelValidator func(string) error
|
|
// 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 Model 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()
|
|
}
|
|
|
|
// ByProvider orders the results by the provider field.
|
|
func ByProvider(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldProvider, opts...).ToFunc()
|
|
}
|
|
|
|
// ByAPIKey orders the results by the api_key field.
|
|
func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
|
|
}
|
|
|
|
// ByBaseURL orders the results by the base_url field.
|
|
func ByBaseURL(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldBaseURL, opts...).ToFunc()
|
|
}
|
|
|
|
// ByModel orders the results by the model field.
|
|
func ByModel(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldModel, opts...).ToFunc()
|
|
}
|
|
|
|
// ByRemark orders the results by the remark field.
|
|
func ByRemark(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldRemark, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTemperature orders the results by the temperature field.
|
|
func ByTemperature(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTemperature, opts...).ToFunc()
|
|
}
|
|
|
|
// ByInterfaceType orders the results by the interface_type field.
|
|
func ByInterfaceType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldInterfaceType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByWeight orders the results by the weight field.
|
|
func ByWeight(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldWeight, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLastCheckAt orders the results by the last_check_at field.
|
|
func ByLastCheckAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLastCheckAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLastCheckSuccess orders the results by the last_check_success field.
|
|
func ByLastCheckSuccess(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLastCheckSuccess, opts...).ToFunc()
|
|
}
|
|
|
|
// ByLastCheckError orders the results by the last_check_error field.
|
|
func ByLastCheckError(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldLastCheckError, 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()
|
|
}
|
|
|
|
// 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...))
|
|
}
|
|
}
|
|
|
|
// ByTeamsCount orders the results by teams count.
|
|
func ByTeamsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newTeamsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByTeams orders the results by teams terms.
|
|
func ByTeams(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// 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...)...)
|
|
}
|
|
}
|
|
|
|
// 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...)...)
|
|
}
|
|
}
|
|
|
|
// ByProjectTasksCount orders the results by project_tasks count.
|
|
func ByProjectTasksCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newProjectTasksStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByProjectTasks orders the results by project_tasks terms.
|
|
func ByProjectTasks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newProjectTasksStep(), append([]sql.OrderTerm{term}, terms...)...)
|
|
}
|
|
}
|
|
|
|
// ByTeamModelsCount orders the results by team_models count.
|
|
func ByTeamModelsCount(opts ...sql.OrderTermOption) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborsCount(s, newTeamModelsStep(), opts...)
|
|
}
|
|
}
|
|
|
|
// ByTeamModels orders the results by team_models terms.
|
|
func ByTeamModels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
|
return func(s *sql.Selector) {
|
|
sqlgraph.OrderByNeighborTerms(s, newTeamModelsStep(), 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...)...)
|
|
}
|
|
}
|
|
func newUserStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(UserInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
)
|
|
}
|
|
func newTeamsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, TeamsTable, TeamsPrimaryKey...),
|
|
)
|
|
}
|
|
func newGroupsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(GroupsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2M, true, GroupsTable, GroupsPrimaryKey...),
|
|
)
|
|
}
|
|
func newVmsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(VmsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, VmsTable, VmsColumn),
|
|
)
|
|
}
|
|
func newProjectTasksStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(ProjectTasksInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, false, ProjectTasksTable, ProjectTasksColumn),
|
|
)
|
|
}
|
|
func newTeamModelsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamModelsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamModelsTable, TeamModelsColumn),
|
|
)
|
|
}
|
|
func newTeamGroupModelsStep() *sqlgraph.Step {
|
|
return sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.To(TeamGroupModelsInverseTable, FieldID),
|
|
sqlgraph.Edge(sqlgraph.O2M, true, TeamGroupModelsTable, TeamGroupModelsColumn),
|
|
)
|
|
}
|