labelrelationship.go 5.5 KB

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