userallowedgroup.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Code generated by ent, DO NOT EDIT.
  2. package userallowedgroup
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. "entgo.io/ent/dialect/sql/sqlgraph"
  7. )
  8. const (
  9. // Label holds the string label denoting the userallowedgroup type in the database.
  10. Label = "user_allowed_group"
  11. // FieldUserID holds the string denoting the user_id field in the database.
  12. FieldUserID = "user_id"
  13. // FieldGroupID holds the string denoting the group_id field in the database.
  14. FieldGroupID = "group_id"
  15. // FieldCreatedAt holds the string denoting the created_at field in the database.
  16. FieldCreatedAt = "created_at"
  17. // EdgeUser holds the string denoting the user edge name in mutations.
  18. EdgeUser = "user"
  19. // EdgeGroup holds the string denoting the group edge name in mutations.
  20. EdgeGroup = "group"
  21. // UserFieldID holds the string denoting the ID field of the User.
  22. UserFieldID = "id"
  23. // GroupFieldID holds the string denoting the ID field of the Group.
  24. GroupFieldID = "id"
  25. // Table holds the table name of the userallowedgroup in the database.
  26. Table = "user_allowed_groups"
  27. // UserTable is the table that holds the user relation/edge.
  28. UserTable = "user_allowed_groups"
  29. // UserInverseTable is the table name for the User entity.
  30. // It exists in this package in order to avoid circular dependency with the "user" package.
  31. UserInverseTable = "users"
  32. // UserColumn is the table column denoting the user relation/edge.
  33. UserColumn = "user_id"
  34. // GroupTable is the table that holds the group relation/edge.
  35. GroupTable = "user_allowed_groups"
  36. // GroupInverseTable is the table name for the Group entity.
  37. // It exists in this package in order to avoid circular dependency with the "group" package.
  38. GroupInverseTable = "groups"
  39. // GroupColumn is the table column denoting the group relation/edge.
  40. GroupColumn = "group_id"
  41. )
  42. // Columns holds all SQL columns for userallowedgroup fields.
  43. var Columns = []string{
  44. FieldUserID,
  45. FieldGroupID,
  46. FieldCreatedAt,
  47. }
  48. // ValidColumn reports if the column name is valid (part of the table columns).
  49. func ValidColumn(column string) bool {
  50. for i := range Columns {
  51. if column == Columns[i] {
  52. return true
  53. }
  54. }
  55. return false
  56. }
  57. var (
  58. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  59. DefaultCreatedAt func() time.Time
  60. )
  61. // OrderOption defines the ordering options for the UserAllowedGroup queries.
  62. type OrderOption func(*sql.Selector)
  63. // ByUserID orders the results by the user_id field.
  64. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  65. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  66. }
  67. // ByGroupID orders the results by the group_id field.
  68. func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
  69. return sql.OrderByField(FieldGroupID, opts...).ToFunc()
  70. }
  71. // ByCreatedAt orders the results by the created_at field.
  72. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  73. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  74. }
  75. // ByUserField orders the results by user field.
  76. func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  77. return func(s *sql.Selector) {
  78. sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
  79. }
  80. }
  81. // ByGroupField orders the results by group field.
  82. func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
  83. return func(s *sql.Selector) {
  84. sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
  85. }
  86. }
  87. func newUserStep() *sqlgraph.Step {
  88. return sqlgraph.NewStep(
  89. sqlgraph.From(Table, UserColumn),
  90. sqlgraph.To(UserInverseTable, UserFieldID),
  91. sqlgraph.Edge(sqlgraph.M2O, false, UserTable, UserColumn),
  92. )
  93. }
  94. func newGroupStep() *sqlgraph.Step {
  95. return sqlgraph.NewStep(
  96. sqlgraph.From(Table, GroupColumn),
  97. sqlgraph.To(GroupInverseTable, GroupFieldID),
  98. sqlgraph.Edge(sqlgraph.M2O, false, GroupTable, GroupColumn),
  99. )
  100. }