xunji.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. // Code generated by ent, DO NOT EDIT.
  2. package xunji
  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 xunji type in the database.
  10. Label = "xunji"
  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. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  20. FieldDeletedAt = "deleted_at"
  21. // FieldAppKey holds the string denoting the app_key field in the database.
  22. FieldAppKey = "app_key"
  23. // FieldAppSecret holds the string denoting the app_secret field in the database.
  24. FieldAppSecret = "app_secret"
  25. // FieldToken holds the string denoting the token field in the database.
  26. FieldToken = "token"
  27. // FieldEncodingKey holds the string denoting the encoding_key field in the database.
  28. FieldEncodingKey = "encoding_key"
  29. // FieldAgentID holds the string denoting the agent_id field in the database.
  30. FieldAgentID = "agent_id"
  31. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  32. FieldOrganizationID = "organization_id"
  33. // FieldWxid holds the string denoting the wxid field in the database.
  34. FieldWxid = "wxid"
  35. // FieldAPIBase holds the string denoting the api_base field in the database.
  36. FieldAPIBase = "api_base"
  37. // FieldAPIKey holds the string denoting the api_key field in the database.
  38. FieldAPIKey = "api_key"
  39. // Table holds the table name of the xunji in the database.
  40. Table = "xunji"
  41. )
  42. // Columns holds all SQL columns for xunji fields.
  43. var Columns = []string{
  44. FieldID,
  45. FieldCreatedAt,
  46. FieldUpdatedAt,
  47. FieldStatus,
  48. FieldDeletedAt,
  49. FieldAppKey,
  50. FieldAppSecret,
  51. FieldToken,
  52. FieldEncodingKey,
  53. FieldAgentID,
  54. FieldOrganizationID,
  55. FieldWxid,
  56. FieldAPIBase,
  57. FieldAPIKey,
  58. }
  59. // ValidColumn reports if the column name is valid (part of the table columns).
  60. func ValidColumn(column string) bool {
  61. for i := range Columns {
  62. if column == Columns[i] {
  63. return true
  64. }
  65. }
  66. return false
  67. }
  68. // Note that the variables below are initialized by the runtime
  69. // package on the initialization of the application. Therefore,
  70. // it should be imported in the main as follows:
  71. //
  72. // import _ "wechat-api/ent/runtime"
  73. var (
  74. Hooks [1]ent.Hook
  75. Interceptors [1]ent.Interceptor
  76. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  77. DefaultCreatedAt func() time.Time
  78. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  79. DefaultUpdatedAt func() time.Time
  80. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  81. UpdateDefaultUpdatedAt func() time.Time
  82. // DefaultStatus holds the default value on creation for the "status" field.
  83. DefaultStatus uint8
  84. // OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
  85. OrganizationIDValidator func(uint64) error
  86. // DefaultAPIBase holds the default value on creation for the "api_base" field.
  87. DefaultAPIBase string
  88. // DefaultAPIKey holds the default value on creation for the "api_key" field.
  89. DefaultAPIKey string
  90. )
  91. // OrderOption defines the ordering options for the Xunji queries.
  92. type OrderOption func(*sql.Selector)
  93. // ByID orders the results by the id field.
  94. func ByID(opts ...sql.OrderTermOption) OrderOption {
  95. return sql.OrderByField(FieldID, opts...).ToFunc()
  96. }
  97. // ByCreatedAt orders the results by the created_at field.
  98. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  99. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  100. }
  101. // ByUpdatedAt orders the results by the updated_at field.
  102. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  103. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  104. }
  105. // ByStatus orders the results by the status field.
  106. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  107. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  108. }
  109. // ByDeletedAt orders the results by the deleted_at field.
  110. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  111. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  112. }
  113. // ByAppKey orders the results by the app_key field.
  114. func ByAppKey(opts ...sql.OrderTermOption) OrderOption {
  115. return sql.OrderByField(FieldAppKey, opts...).ToFunc()
  116. }
  117. // ByAppSecret orders the results by the app_secret field.
  118. func ByAppSecret(opts ...sql.OrderTermOption) OrderOption {
  119. return sql.OrderByField(FieldAppSecret, opts...).ToFunc()
  120. }
  121. // ByToken orders the results by the token field.
  122. func ByToken(opts ...sql.OrderTermOption) OrderOption {
  123. return sql.OrderByField(FieldToken, opts...).ToFunc()
  124. }
  125. // ByEncodingKey orders the results by the encoding_key field.
  126. func ByEncodingKey(opts ...sql.OrderTermOption) OrderOption {
  127. return sql.OrderByField(FieldEncodingKey, opts...).ToFunc()
  128. }
  129. // ByAgentID orders the results by the agent_id field.
  130. func ByAgentID(opts ...sql.OrderTermOption) OrderOption {
  131. return sql.OrderByField(FieldAgentID, opts...).ToFunc()
  132. }
  133. // ByOrganizationID orders the results by the organization_id field.
  134. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  135. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  136. }
  137. // ByWxid orders the results by the wxid field.
  138. func ByWxid(opts ...sql.OrderTermOption) OrderOption {
  139. return sql.OrderByField(FieldWxid, opts...).ToFunc()
  140. }
  141. // ByAPIBase orders the results by the api_base field.
  142. func ByAPIBase(opts ...sql.OrderTermOption) OrderOption {
  143. return sql.OrderByField(FieldAPIBase, opts...).ToFunc()
  144. }
  145. // ByAPIKey orders the results by the api_key field.
  146. func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
  147. return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
  148. }