labelrelationship.go 5.7 KB

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