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

103 lines
3.5 KiB
Go

// Code generated by ent, DO NOT EDIT.
package usergroupuser
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the usergroupuser type in the database.
Label = "user_group_user"
// 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"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// EdgeUserGroup holds the string denoting the user_group edge name in mutations.
EdgeUserGroup = "user_group"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// Table holds the table name of the usergroupuser in the database.
Table = "user_group_users"
// UserGroupTable is the table that holds the user_group relation/edge.
UserGroupTable = "user_group_users"
// 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"
// UserTable is the table that holds the user relation/edge.
UserTable = "user_group_users"
// 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"
)
// Columns holds all SQL columns for usergroupuser fields.
var Columns = []string{
FieldID,
FieldUserGroupID,
FieldUserID,
}
// 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 UserGroupUser 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()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, 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...))
}
}
// 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...))
}
}
func newUserGroupStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserGroupInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, UserGroupTable, UserGroupColumn),
)
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, UserTable, UserColumn),
)
}