Files
MonkeyCode/backend/db/usergroupadmin/usergroupadmin.go
2025-08-18 14:57:29 +08:00

103 lines
3.5 KiB
Go

// Code generated by ent, DO NOT EDIT.
package usergroupadmin
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the usergroupadmin type in the database.
Label = "user_group_admin"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldUserGroupID holds the string denoting the user_group_id field in the database.
FieldUserGroupID = "user_group_id"
// FieldAdminID holds the string denoting the admin_id field in the database.
FieldAdminID = "admin_id"
// EdgeUserGroup holds the string denoting the user_group edge name in mutations.
EdgeUserGroup = "user_group"
// EdgeAdmin holds the string denoting the admin edge name in mutations.
EdgeAdmin = "admin"
// Table holds the table name of the usergroupadmin in the database.
Table = "user_group_admins"
// UserGroupTable is the table that holds the user_group relation/edge.
UserGroupTable = "user_group_admins"
// UserGroupInverseTable is the table name for the UserGroup entity.
// It exists in this package in order to avoid circular dependency with the "usergroup" package.
UserGroupInverseTable = "user_groups"
// UserGroupColumn is the table column denoting the user_group relation/edge.
UserGroupColumn = "user_group_id"
// AdminTable is the table that holds the admin relation/edge.
AdminTable = "user_group_admins"
// AdminInverseTable is the table name for the Admin entity.
// It exists in this package in order to avoid circular dependency with the "admin" package.
AdminInverseTable = "admins"
// AdminColumn is the table column denoting the admin relation/edge.
AdminColumn = "admin_id"
)
// Columns holds all SQL columns for usergroupadmin fields.
var Columns = []string{
FieldID,
FieldUserGroupID,
FieldAdminID,
}
// 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
}
// OrderOption defines the ordering options for the UserGroupAdmin 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()
}
// ByUserGroupID orders the results by the user_group_id field.
func ByUserGroupID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserGroupID, opts...).ToFunc()
}
// ByAdminID orders the results by the admin_id field.
func ByAdminID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAdminID, opts...).ToFunc()
}
// ByUserGroupField orders the results by user_group field.
func ByUserGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserGroupStep(), sql.OrderByField(field, opts...))
}
}
// ByAdminField orders the results by admin field.
func ByAdminField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAdminStep(), sql.OrderByField(field, opts...))
}
}
func newUserGroupStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserGroupInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, UserGroupTable, UserGroupColumn),
)
}
func newAdminStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AdminInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, AdminTable, AdminColumn),
)
}