accountgroup.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // Code generated by ent, DO NOT EDIT.
  2. package accountgroup
  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 accountgroup type in the database.
  10. Label = "account_group"
  11. // FieldAccountID holds the string denoting the account_id field in the database.
  12. FieldAccountID = "account_id"
  13. // FieldGroupID holds the string denoting the group_id field in the database.
  14. FieldGroupID = "group_id"
  15. // FieldPriority holds the string denoting the priority field in the database.
  16. FieldPriority = "priority"
  17. // FieldCreatedAt holds the string denoting the created_at field in the database.
  18. FieldCreatedAt = "created_at"
  19. // EdgeAccount holds the string denoting the account edge name in mutations.
  20. EdgeAccount = "account"
  21. // EdgeGroup holds the string denoting the group edge name in mutations.
  22. EdgeGroup = "group"
  23. // AccountFieldID holds the string denoting the ID field of the Account.
  24. AccountFieldID = "id"
  25. // GroupFieldID holds the string denoting the ID field of the Group.
  26. GroupFieldID = "id"
  27. // Table holds the table name of the accountgroup in the database.
  28. Table = "account_groups"
  29. // AccountTable is the table that holds the account relation/edge.
  30. AccountTable = "account_groups"
  31. // AccountInverseTable is the table name for the Account entity.
  32. // It exists in this package in order to avoid circular dependency with the "account" package.
  33. AccountInverseTable = "accounts"
  34. // AccountColumn is the table column denoting the account relation/edge.
  35. AccountColumn = "account_id"
  36. // GroupTable is the table that holds the group relation/edge.
  37. GroupTable = "account_groups"
  38. // GroupInverseTable is the table name for the Group entity.
  39. // It exists in this package in order to avoid circular dependency with the "group" package.
  40. GroupInverseTable = "groups"
  41. // GroupColumn is the table column denoting the group relation/edge.
  42. GroupColumn = "group_id"
  43. )
  44. // Columns holds all SQL columns for accountgroup fields.
  45. var Columns = []string{
  46. FieldAccountID,
  47. FieldGroupID,
  48. FieldPriority,
  49. FieldCreatedAt,
  50. }
  51. // ValidColumn reports if the column name is valid (part of the table columns).
  52. func ValidColumn(column string) bool {
  53. for i := range Columns {
  54. if column == Columns[i] {
  55. return true
  56. }
  57. }
  58. return false
  59. }
  60. var (
  61. // DefaultPriority holds the default value on creation for the "priority" field.
  62. DefaultPriority int
  63. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  64. DefaultCreatedAt func() time.Time
  65. )
  66. // OrderOption defines the ordering options for the AccountGroup queries.
  67. type OrderOption func(*sql.Selector)
  68. // ByAccountID orders the results by the account_id field.
  69. func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
  70. return sql.OrderByField(FieldAccountID, opts...).ToFunc()
  71. }
  72. // ByGroupID orders the results by the group_id field.
  73. func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
  74. return sql.OrderByField(FieldGroupID, opts...).ToFunc()
  75. }
  76. // ByPriority orders the results by the priority field.
  77. func ByPriority(opts ...sql.OrderTermOption) OrderOption {
  78. return sql.OrderByField(FieldPriority, opts...).ToFunc()
  79. }
  80. // ByCreatedAt orders the results by the created_at field.
  81. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  82. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  83. }
  84. // ByAccountField orders the results by account field.
  85. func ByAccountField(field string, opts ...sql.OrderTermOption) OrderOption {
  86. return func(s *sql.Selector) {
  87. sqlgraph.OrderByNeighborTerms(s, newAccountStep(), sql.OrderByField(field, opts...))
  88. }
  89. }
  90. // ByGroupField orders the results by group field.
  91. func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
  92. return func(s *sql.Selector) {
  93. sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
  94. }
  95. }
  96. func newAccountStep() *sqlgraph.Step {
  97. return sqlgraph.NewStep(
  98. sqlgraph.From(Table, AccountColumn),
  99. sqlgraph.To(AccountInverseTable, AccountFieldID),
  100. sqlgraph.Edge(sqlgraph.M2O, false, AccountTable, AccountColumn),
  101. )
  102. }
  103. func newGroupStep() *sqlgraph.Step {
  104. return sqlgraph.NewStep(
  105. sqlgraph.From(Table, GroupColumn),
  106. sqlgraph.To(GroupInverseTable, GroupFieldID),
  107. sqlgraph.Edge(sqlgraph.M2O, false, GroupTable, GroupColumn),
  108. )
  109. }