agent.go 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. // Code generated by ent, DO NOT EDIT.
  2. package agent
  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 agent type in the database.
  11. Label = "agent"
  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. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  19. FieldDeletedAt = "deleted_at"
  20. // FieldName holds the string denoting the name field in the database.
  21. FieldName = "name"
  22. // FieldRole holds the string denoting the role field in the database.
  23. FieldRole = "role"
  24. // FieldStatus holds the string denoting the status field in the database.
  25. FieldStatus = "status"
  26. // FieldBackground holds the string denoting the background field in the database.
  27. FieldBackground = "background"
  28. // FieldExamples holds the string denoting the examples field in the database.
  29. FieldExamples = "examples"
  30. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  31. FieldOrganizationID = "organization_id"
  32. // FieldDatasetID holds the string denoting the dataset_id field in the database.
  33. FieldDatasetID = "dataset_id"
  34. // FieldCollectionID holds the string denoting the collection_id field in the database.
  35. FieldCollectionID = "collection_id"
  36. // EdgeWxAgent holds the string denoting the wx_agent edge name in mutations.
  37. EdgeWxAgent = "wx_agent"
  38. // Table holds the table name of the agent in the database.
  39. Table = "agent"
  40. // WxAgentTable is the table that holds the wx_agent relation/edge.
  41. WxAgentTable = "wx"
  42. // WxAgentInverseTable is the table name for the Wx entity.
  43. // It exists in this package in order to avoid circular dependency with the "wx" package.
  44. WxAgentInverseTable = "wx"
  45. // WxAgentColumn is the table column denoting the wx_agent relation/edge.
  46. WxAgentColumn = "agent_id"
  47. )
  48. // Columns holds all SQL columns for agent fields.
  49. var Columns = []string{
  50. FieldID,
  51. FieldCreatedAt,
  52. FieldUpdatedAt,
  53. FieldDeletedAt,
  54. FieldName,
  55. FieldRole,
  56. FieldStatus,
  57. FieldBackground,
  58. FieldExamples,
  59. FieldOrganizationID,
  60. FieldDatasetID,
  61. FieldCollectionID,
  62. }
  63. // ValidColumn reports if the column name is valid (part of the table columns).
  64. func ValidColumn(column string) bool {
  65. for i := range Columns {
  66. if column == Columns[i] {
  67. return true
  68. }
  69. }
  70. return false
  71. }
  72. // Note that the variables below are initialized by the runtime
  73. // package on the initialization of the application. Therefore,
  74. // it should be imported in the main as follows:
  75. //
  76. // import _ "wechat-api/ent/runtime"
  77. var (
  78. Hooks [1]ent.Hook
  79. Interceptors [1]ent.Interceptor
  80. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  81. DefaultCreatedAt func() time.Time
  82. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  83. DefaultUpdatedAt func() time.Time
  84. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  85. UpdateDefaultUpdatedAt func() time.Time
  86. // NameValidator is a validator for the "name" field. It is called by the builders before save.
  87. NameValidator func(string) error
  88. // RoleValidator is a validator for the "role" field. It is called by the builders before save.
  89. RoleValidator func(string) error
  90. // DefaultStatus holds the default value on creation for the "status" field.
  91. DefaultStatus int
  92. // StatusValidator is a validator for the "status" field. It is called by the builders before save.
  93. StatusValidator func(int) error
  94. // DefaultBackground holds the default value on creation for the "background" field.
  95. DefaultBackground string
  96. // BackgroundValidator is a validator for the "background" field. It is called by the builders before save.
  97. BackgroundValidator func(string) error
  98. // DefaultExamples holds the default value on creation for the "examples" field.
  99. DefaultExamples string
  100. // ExamplesValidator is a validator for the "examples" field. It is called by the builders before save.
  101. ExamplesValidator func(string) error
  102. // OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
  103. OrganizationIDValidator func(uint64) error
  104. // DatasetIDValidator is a validator for the "dataset_id" field. It is called by the builders before save.
  105. DatasetIDValidator func(string) error
  106. // CollectionIDValidator is a validator for the "collection_id" field. It is called by the builders before save.
  107. CollectionIDValidator func(string) error
  108. )
  109. // OrderOption defines the ordering options for the Agent queries.
  110. type OrderOption func(*sql.Selector)
  111. // ByID orders the results by the id field.
  112. func ByID(opts ...sql.OrderTermOption) OrderOption {
  113. return sql.OrderByField(FieldID, opts...).ToFunc()
  114. }
  115. // ByCreatedAt orders the results by the created_at field.
  116. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  117. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  118. }
  119. // ByUpdatedAt orders the results by the updated_at field.
  120. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  121. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  122. }
  123. // ByDeletedAt orders the results by the deleted_at field.
  124. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  125. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  126. }
  127. // ByName orders the results by the name field.
  128. func ByName(opts ...sql.OrderTermOption) OrderOption {
  129. return sql.OrderByField(FieldName, opts...).ToFunc()
  130. }
  131. // ByRole orders the results by the role field.
  132. func ByRole(opts ...sql.OrderTermOption) OrderOption {
  133. return sql.OrderByField(FieldRole, opts...).ToFunc()
  134. }
  135. // ByStatus orders the results by the status field.
  136. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  137. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  138. }
  139. // ByBackground orders the results by the background field.
  140. func ByBackground(opts ...sql.OrderTermOption) OrderOption {
  141. return sql.OrderByField(FieldBackground, opts...).ToFunc()
  142. }
  143. // ByExamples orders the results by the examples field.
  144. func ByExamples(opts ...sql.OrderTermOption) OrderOption {
  145. return sql.OrderByField(FieldExamples, opts...).ToFunc()
  146. }
  147. // ByOrganizationID orders the results by the organization_id field.
  148. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  149. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  150. }
  151. // ByDatasetID orders the results by the dataset_id field.
  152. func ByDatasetID(opts ...sql.OrderTermOption) OrderOption {
  153. return sql.OrderByField(FieldDatasetID, opts...).ToFunc()
  154. }
  155. // ByCollectionID orders the results by the collection_id field.
  156. func ByCollectionID(opts ...sql.OrderTermOption) OrderOption {
  157. return sql.OrderByField(FieldCollectionID, opts...).ToFunc()
  158. }
  159. // ByWxAgentCount orders the results by wx_agent count.
  160. func ByWxAgentCount(opts ...sql.OrderTermOption) OrderOption {
  161. return func(s *sql.Selector) {
  162. sqlgraph.OrderByNeighborsCount(s, newWxAgentStep(), opts...)
  163. }
  164. }
  165. // ByWxAgent orders the results by wx_agent terms.
  166. func ByWxAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  167. return func(s *sql.Selector) {
  168. sqlgraph.OrderByNeighborTerms(s, newWxAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
  169. }
  170. }
  171. func newWxAgentStep() *sqlgraph.Step {
  172. return sqlgraph.NewStep(
  173. sqlgraph.From(Table, FieldID),
  174. sqlgraph.To(WxAgentInverseTable, FieldID),
  175. sqlgraph.Edge(sqlgraph.O2M, false, WxAgentTable, WxAgentColumn),
  176. )
  177. }