agent.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. )
  8. const (
  9. // Label holds the string label denoting the agent type in the database.
  10. Label = "agent"
  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. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  18. FieldDeletedAt = "deleted_at"
  19. // FieldName holds the string denoting the name field in the database.
  20. FieldName = "name"
  21. // FieldRole holds the string denoting the role field in the database.
  22. FieldRole = "role"
  23. // FieldStatus holds the string denoting the status field in the database.
  24. FieldStatus = "status"
  25. // FieldBackground holds the string denoting the background field in the database.
  26. FieldBackground = "background"
  27. // FieldExamples holds the string denoting the examples field in the database.
  28. FieldExamples = "examples"
  29. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  30. FieldOrganizationID = "organization_id"
  31. // Table holds the table name of the agent in the database.
  32. Table = "agent"
  33. )
  34. // Columns holds all SQL columns for agent fields.
  35. var Columns = []string{
  36. FieldID,
  37. FieldCreatedAt,
  38. FieldUpdatedAt,
  39. FieldDeletedAt,
  40. FieldName,
  41. FieldRole,
  42. FieldStatus,
  43. FieldBackground,
  44. FieldExamples,
  45. FieldOrganizationID,
  46. }
  47. // ValidColumn reports if the column name is valid (part of the table columns).
  48. func ValidColumn(column string) bool {
  49. for i := range Columns {
  50. if column == Columns[i] {
  51. return true
  52. }
  53. }
  54. return false
  55. }
  56. // Note that the variables below are initialized by the runtime
  57. // package on the initialization of the application. Therefore,
  58. // it should be imported in the main as follows:
  59. //
  60. // import _ "wechat-api/ent/runtime"
  61. var (
  62. Hooks [1]ent.Hook
  63. Interceptors [1]ent.Interceptor
  64. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  65. DefaultCreatedAt func() time.Time
  66. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  67. DefaultUpdatedAt func() time.Time
  68. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  69. UpdateDefaultUpdatedAt func() time.Time
  70. // NameValidator is a validator for the "name" field. It is called by the builders before save.
  71. NameValidator func(string) error
  72. // RoleValidator is a validator for the "role" field. It is called by the builders before save.
  73. RoleValidator func(string) error
  74. // DefaultStatus holds the default value on creation for the "status" field.
  75. DefaultStatus int
  76. // BackgroundValidator is a validator for the "background" field. It is called by the builders before save.
  77. BackgroundValidator func(string) error
  78. // ExamplesValidator is a validator for the "examples" field. It is called by the builders before save.
  79. ExamplesValidator func(string) error
  80. )
  81. // OrderOption defines the ordering options for the Agent 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. // ByDeletedAt orders the results by the deleted_at field.
  96. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  97. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  98. }
  99. // ByName orders the results by the name field.
  100. func ByName(opts ...sql.OrderTermOption) OrderOption {
  101. return sql.OrderByField(FieldName, opts...).ToFunc()
  102. }
  103. // ByRole orders the results by the role field.
  104. func ByRole(opts ...sql.OrderTermOption) OrderOption {
  105. return sql.OrderByField(FieldRole, opts...).ToFunc()
  106. }
  107. // ByStatus orders the results by the status field.
  108. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  109. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  110. }
  111. // ByBackground orders the results by the background field.
  112. func ByBackground(opts ...sql.OrderTermOption) OrderOption {
  113. return sql.OrderByField(FieldBackground, opts...).ToFunc()
  114. }
  115. // ByExamples orders the results by the examples field.
  116. func ByExamples(opts ...sql.OrderTermOption) OrderOption {
  117. return sql.OrderByField(FieldExamples, opts...).ToFunc()
  118. }
  119. // ByOrganizationID orders the results by the organization_id field.
  120. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  121. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  122. }