| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // Code generated by ent, DO NOT EDIT.
- package userallowedgroup
- import (
- "time"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- )
- const (
- // Label holds the string label denoting the userallowedgroup type in the database.
- Label = "user_allowed_group"
- // FieldUserID holds the string denoting the user_id field in the database.
- FieldUserID = "user_id"
- // FieldGroupID holds the string denoting the group_id field in the database.
- FieldGroupID = "group_id"
- // FieldCreatedAt holds the string denoting the created_at field in the database.
- FieldCreatedAt = "created_at"
- // EdgeUser holds the string denoting the user edge name in mutations.
- EdgeUser = "user"
- // EdgeGroup holds the string denoting the group edge name in mutations.
- EdgeGroup = "group"
- // UserFieldID holds the string denoting the ID field of the User.
- UserFieldID = "id"
- // GroupFieldID holds the string denoting the ID field of the Group.
- GroupFieldID = "id"
- // Table holds the table name of the userallowedgroup in the database.
- Table = "user_allowed_groups"
- // UserTable is the table that holds the user relation/edge.
- UserTable = "user_allowed_groups"
- // 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"
- // GroupTable is the table that holds the group relation/edge.
- GroupTable = "user_allowed_groups"
- // GroupInverseTable is the table name for the Group entity.
- // It exists in this package in order to avoid circular dependency with the "group" package.
- GroupInverseTable = "groups"
- // GroupColumn is the table column denoting the group relation/edge.
- GroupColumn = "group_id"
- )
- // Columns holds all SQL columns for userallowedgroup fields.
- var Columns = []string{
- FieldUserID,
- FieldGroupID,
- FieldCreatedAt,
- }
- // 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
- }
- var (
- // DefaultCreatedAt holds the default value on creation for the "created_at" field.
- DefaultCreatedAt func() time.Time
- )
- // OrderOption defines the ordering options for the UserAllowedGroup queries.
- type OrderOption func(*sql.Selector)
- // ByUserID orders the results by the user_id field.
- func ByUserID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldUserID, opts...).ToFunc()
- }
- // ByGroupID orders the results by the group_id field.
- func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldGroupID, opts...).ToFunc()
- }
- // ByCreatedAt orders the results by the created_at field.
- func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldCreatedAt, 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...))
- }
- }
- // ByGroupField orders the results by group field.
- func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
- }
- }
- func newUserStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, UserColumn),
- sqlgraph.To(UserInverseTable, UserFieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, UserTable, UserColumn),
- )
- }
- func newGroupStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, GroupColumn),
- sqlgraph.To(GroupInverseTable, GroupFieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, GroupTable, GroupColumn),
- )
- }
|