labelrelationship.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // Code generated by ent, DO NOT EDIT.
  2. package labelrelationship
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. const (
  10. // Label holds the string label denoting the labelrelationship type in the database.
  11. Label = "label_relationship"
  12. // FieldID holds the string denoting the id field in the database.
  13. FieldID = "id"
  14. // FieldCreatedAt holds the string denoting the created_at field in the database.
  15. FieldCreatedAt = "created_at"
  16. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  17. FieldUpdatedAt = "updated_at"
  18. // FieldStatus holds the string denoting the status field in the database.
  19. FieldStatus = "status"
  20. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  21. FieldDeletedAt = "deleted_at"
  22. // FieldLabelID holds the string denoting the label_id field in the database.
  23. FieldLabelID = "label_id"
  24. // FieldContactID holds the string denoting the contact_id field in the database.
  25. FieldContactID = "contact_id"
  26. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  27. FieldOrganizationID = "organization_id"
  28. // EdgeContacts holds the string denoting the contacts edge name in mutations.
  29. EdgeContacts = "contacts"
  30. // EdgeLabels holds the string denoting the labels edge name in mutations.
  31. EdgeLabels = "labels"
  32. // Table holds the table name of the labelrelationship in the database.
  33. Table = "label_relationship"
  34. // ContactsTable is the table that holds the contacts relation/edge.
  35. ContactsTable = "label_relationship"
  36. // ContactsInverseTable is the table name for the Contact entity.
  37. // It exists in this package in order to avoid circular dependency with the "contact" package.
  38. ContactsInverseTable = "contact"
  39. // ContactsColumn is the table column denoting the contacts relation/edge.
  40. ContactsColumn = "contact_id"
  41. // LabelsTable is the table that holds the labels relation/edge.
  42. LabelsTable = "label_relationship"
  43. // LabelsInverseTable is the table name for the Label entity.
  44. // It exists in this package in order to avoid circular dependency with the "label" package.
  45. LabelsInverseTable = "label"
  46. // LabelsColumn is the table column denoting the labels relation/edge.
  47. LabelsColumn = "label_id"
  48. )
  49. // Columns holds all SQL columns for labelrelationship fields.
  50. var Columns = []string{
  51. FieldID,
  52. FieldCreatedAt,
  53. FieldUpdatedAt,
  54. FieldStatus,
  55. FieldDeletedAt,
  56. FieldLabelID,
  57. FieldContactID,
  58. FieldOrganizationID,
  59. }
  60. // ValidColumn reports if the column name is valid (part of the table columns).
  61. func ValidColumn(column string) bool {
  62. for i := range Columns {
  63. if column == Columns[i] {
  64. return true
  65. }
  66. }
  67. return false
  68. }
  69. // Note that the variables below are initialized by the runtime
  70. // package on the initialization of the application. Therefore,
  71. // it should be imported in the main as follows:
  72. //
  73. // import _ "wechat-api/ent/runtime"
  74. var (
  75. Hooks [1]ent.Hook
  76. Interceptors [1]ent.Interceptor
  77. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  78. DefaultCreatedAt func() time.Time
  79. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  80. DefaultUpdatedAt func() time.Time
  81. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  82. UpdateDefaultUpdatedAt func() time.Time
  83. // DefaultStatus holds the default value on creation for the "status" field.
  84. DefaultStatus uint8
  85. // DefaultLabelID holds the default value on creation for the "label_id" field.
  86. DefaultLabelID uint64
  87. // DefaultContactID holds the default value on creation for the "contact_id" field.
  88. DefaultContactID uint64
  89. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  90. DefaultOrganizationID uint64
  91. )
  92. // OrderOption defines the ordering options for the LabelRelationship queries.
  93. type OrderOption func(*sql.Selector)
  94. // ByID orders the results by the id field.
  95. func ByID(opts ...sql.OrderTermOption) OrderOption {
  96. return sql.OrderByField(FieldID, opts...).ToFunc()
  97. }
  98. // ByCreatedAt orders the results by the created_at field.
  99. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  100. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  101. }
  102. // ByUpdatedAt orders the results by the updated_at field.
  103. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  104. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  105. }
  106. // ByStatus orders the results by the status field.
  107. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  108. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  109. }
  110. // ByDeletedAt orders the results by the deleted_at field.
  111. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  112. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  113. }
  114. // ByLabelID orders the results by the label_id field.
  115. func ByLabelID(opts ...sql.OrderTermOption) OrderOption {
  116. return sql.OrderByField(FieldLabelID, opts...).ToFunc()
  117. }
  118. // ByContactID orders the results by the contact_id field.
  119. func ByContactID(opts ...sql.OrderTermOption) OrderOption {
  120. return sql.OrderByField(FieldContactID, opts...).ToFunc()
  121. }
  122. // ByOrganizationID orders the results by the organization_id field.
  123. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  124. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  125. }
  126. // ByContactsField orders the results by contacts field.
  127. func ByContactsField(field string, opts ...sql.OrderTermOption) OrderOption {
  128. return func(s *sql.Selector) {
  129. sqlgraph.OrderByNeighborTerms(s, newContactsStep(), sql.OrderByField(field, opts...))
  130. }
  131. }
  132. // ByLabelsField orders the results by labels field.
  133. func ByLabelsField(field string, opts ...sql.OrderTermOption) OrderOption {
  134. return func(s *sql.Selector) {
  135. sqlgraph.OrderByNeighborTerms(s, newLabelsStep(), sql.OrderByField(field, opts...))
  136. }
  137. }
  138. func newContactsStep() *sqlgraph.Step {
  139. return sqlgraph.NewStep(
  140. sqlgraph.From(Table, FieldID),
  141. sqlgraph.To(ContactsInverseTable, FieldID),
  142. sqlgraph.Edge(sqlgraph.M2O, true, ContactsTable, ContactsColumn),
  143. )
  144. }
  145. func newLabelsStep() *sqlgraph.Step {
  146. return sqlgraph.NewStep(
  147. sqlgraph.From(Table, FieldID),
  148. sqlgraph.To(LabelsInverseTable, FieldID),
  149. sqlgraph.Edge(sqlgraph.M2O, true, LabelsTable, LabelsColumn),
  150. )
  151. }