label.go 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. // Code generated by ent, DO NOT EDIT.
  2. package label
  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 label type in the database.
  10. Label = "label"
  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. // FieldType holds the string denoting the type field in the database.
  20. FieldType = "type"
  21. // FieldName holds the string denoting the name field in the database.
  22. FieldName = "name"
  23. // FieldFrom holds the string denoting the from field in the database.
  24. FieldFrom = "from"
  25. // FieldMode holds the string denoting the mode field in the database.
  26. FieldMode = "mode"
  27. // FieldConditions holds the string denoting the conditions field in the database.
  28. FieldConditions = "conditions"
  29. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  30. FieldOrganizationID = "organization_id"
  31. // EdgeLabelRelationships holds the string denoting the label_relationships edge name in mutations.
  32. EdgeLabelRelationships = "label_relationships"
  33. // Table holds the table name of the label in the database.
  34. Table = "label"
  35. // LabelRelationshipsTable is the table that holds the label_relationships relation/edge.
  36. LabelRelationshipsTable = "label_relationship"
  37. // LabelRelationshipsInverseTable is the table name for the LabelRelationship entity.
  38. // It exists in this package in order to avoid circular dependency with the "labelrelationship" package.
  39. LabelRelationshipsInverseTable = "label_relationship"
  40. // LabelRelationshipsColumn is the table column denoting the label_relationships relation/edge.
  41. LabelRelationshipsColumn = "label_id"
  42. )
  43. // Columns holds all SQL columns for label fields.
  44. var Columns = []string{
  45. FieldID,
  46. FieldCreatedAt,
  47. FieldUpdatedAt,
  48. FieldStatus,
  49. FieldType,
  50. FieldName,
  51. FieldFrom,
  52. FieldMode,
  53. FieldConditions,
  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. // DefaultType holds the default value on creation for the "type" field.
  75. DefaultType int
  76. // DefaultName holds the default value on creation for the "name" field.
  77. DefaultName string
  78. // DefaultFrom holds the default value on creation for the "from" field.
  79. DefaultFrom int
  80. // DefaultMode holds the default value on creation for the "mode" field.
  81. DefaultMode int
  82. // DefaultConditions holds the default value on creation for the "conditions" field.
  83. DefaultConditions string
  84. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  85. DefaultOrganizationID uint64
  86. )
  87. // OrderOption defines the ordering options for the Label 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. // ByType orders the results by the type field.
  106. func ByType(opts ...sql.OrderTermOption) OrderOption {
  107. return sql.OrderByField(FieldType, opts...).ToFunc()
  108. }
  109. // ByName orders the results by the name field.
  110. func ByName(opts ...sql.OrderTermOption) OrderOption {
  111. return sql.OrderByField(FieldName, opts...).ToFunc()
  112. }
  113. // ByFrom orders the results by the from field.
  114. func ByFrom(opts ...sql.OrderTermOption) OrderOption {
  115. return sql.OrderByField(FieldFrom, opts...).ToFunc()
  116. }
  117. // ByMode orders the results by the mode field.
  118. func ByMode(opts ...sql.OrderTermOption) OrderOption {
  119. return sql.OrderByField(FieldMode, opts...).ToFunc()
  120. }
  121. // ByConditions orders the results by the conditions field.
  122. func ByConditions(opts ...sql.OrderTermOption) OrderOption {
  123. return sql.OrderByField(FieldConditions, opts...).ToFunc()
  124. }
  125. // ByOrganizationID orders the results by the organization_id field.
  126. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  127. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  128. }
  129. // ByLabelRelationshipsCount orders the results by label_relationships count.
  130. func ByLabelRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
  131. return func(s *sql.Selector) {
  132. sqlgraph.OrderByNeighborsCount(s, newLabelRelationshipsStep(), opts...)
  133. }
  134. }
  135. // ByLabelRelationships orders the results by label_relationships terms.
  136. func ByLabelRelationships(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  137. return func(s *sql.Selector) {
  138. sqlgraph.OrderByNeighborTerms(s, newLabelRelationshipsStep(), append([]sql.OrderTerm{term}, terms...)...)
  139. }
  140. }
  141. func newLabelRelationshipsStep() *sqlgraph.Step {
  142. return sqlgraph.NewStep(
  143. sqlgraph.From(Table, FieldID),
  144. sqlgraph.To(LabelRelationshipsInverseTable, FieldID),
  145. sqlgraph.Edge(sqlgraph.O2M, false, LabelRelationshipsTable, LabelRelationshipsColumn),
  146. )
  147. }