whatsapp.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. // Code generated by ent, DO NOT EDIT.
  2. package whatsapp
  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 whatsapp type in the database.
  11. Label = "whatsapp"
  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. // FieldStatus holds the string denoting the status field in the database.
  19. FieldStatus = "status"
  20. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  21. FieldDeletedAt = "deleted_at"
  22. // FieldAk holds the string denoting the ak field in the database.
  23. FieldAk = "ak"
  24. // FieldSk holds the string denoting the sk field in the database.
  25. FieldSk = "sk"
  26. // FieldCallback holds the string denoting the callback field in the database.
  27. FieldCallback = "callback"
  28. // FieldAccount holds the string denoting the account field in the database.
  29. FieldAccount = "account"
  30. // FieldNickname holds the string denoting the nickname field in the database.
  31. FieldNickname = "nickname"
  32. // FieldPhone holds the string denoting the phone field in the database.
  33. FieldPhone = "phone"
  34. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  35. FieldOrganizationID = "organization_id"
  36. // FieldAgentID holds the string denoting the agent_id field in the database.
  37. FieldAgentID = "agent_id"
  38. // FieldAPIBase holds the string denoting the api_base field in the database.
  39. FieldAPIBase = "api_base"
  40. // FieldAPIKey holds the string denoting the api_key field in the database.
  41. FieldAPIKey = "api_key"
  42. // FieldAllowList holds the string denoting the allow_list field in the database.
  43. FieldAllowList = "allow_list"
  44. // FieldGroupAllowList holds the string denoting the group_allow_list field in the database.
  45. FieldGroupAllowList = "group_allow_list"
  46. // FieldBlockList holds the string denoting the block_list field in the database.
  47. FieldBlockList = "block_list"
  48. // FieldGroupBlockList holds the string denoting the group_block_list field in the database.
  49. FieldGroupBlockList = "group_block_list"
  50. // EdgeAgent holds the string denoting the agent edge name in mutations.
  51. EdgeAgent = "agent"
  52. // Table holds the table name of the whatsapp in the database.
  53. Table = "whatsapp"
  54. // AgentTable is the table that holds the agent relation/edge.
  55. AgentTable = "whatsapp"
  56. // AgentInverseTable is the table name for the Agent entity.
  57. // It exists in this package in order to avoid circular dependency with the "agent" package.
  58. AgentInverseTable = "agent"
  59. // AgentColumn is the table column denoting the agent relation/edge.
  60. AgentColumn = "agent_id"
  61. )
  62. // Columns holds all SQL columns for whatsapp fields.
  63. var Columns = []string{
  64. FieldID,
  65. FieldCreatedAt,
  66. FieldUpdatedAt,
  67. FieldStatus,
  68. FieldDeletedAt,
  69. FieldAk,
  70. FieldSk,
  71. FieldCallback,
  72. FieldAccount,
  73. FieldNickname,
  74. FieldPhone,
  75. FieldOrganizationID,
  76. FieldAgentID,
  77. FieldAPIBase,
  78. FieldAPIKey,
  79. FieldAllowList,
  80. FieldGroupAllowList,
  81. FieldBlockList,
  82. FieldGroupBlockList,
  83. }
  84. // ValidColumn reports if the column name is valid (part of the table columns).
  85. func ValidColumn(column string) bool {
  86. for i := range Columns {
  87. if column == Columns[i] {
  88. return true
  89. }
  90. }
  91. return false
  92. }
  93. // Note that the variables below are initialized by the runtime
  94. // package on the initialization of the application. Therefore,
  95. // it should be imported in the main as follows:
  96. //
  97. // import _ "wechat-api/ent/runtime"
  98. var (
  99. Hooks [1]ent.Hook
  100. Interceptors [1]ent.Interceptor
  101. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  102. DefaultCreatedAt func() time.Time
  103. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  104. DefaultUpdatedAt func() time.Time
  105. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  106. UpdateDefaultUpdatedAt func() time.Time
  107. // DefaultStatus holds the default value on creation for the "status" field.
  108. DefaultStatus uint8
  109. // DefaultAk holds the default value on creation for the "ak" field.
  110. DefaultAk string
  111. // DefaultSk holds the default value on creation for the "sk" field.
  112. DefaultSk string
  113. // DefaultCallback holds the default value on creation for the "callback" field.
  114. DefaultCallback string
  115. // DefaultAccount holds the default value on creation for the "account" field.
  116. DefaultAccount string
  117. // DefaultNickname holds the default value on creation for the "nickname" field.
  118. DefaultNickname string
  119. // DefaultPhone holds the default value on creation for the "phone" field.
  120. DefaultPhone string
  121. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  122. DefaultOrganizationID uint64
  123. // DefaultAgentID holds the default value on creation for the "agent_id" field.
  124. DefaultAgentID uint64
  125. // DefaultAPIBase holds the default value on creation for the "api_base" field.
  126. DefaultAPIBase string
  127. // DefaultAPIKey holds the default value on creation for the "api_key" field.
  128. DefaultAPIKey string
  129. )
  130. // OrderOption defines the ordering options for the Whatsapp queries.
  131. type OrderOption func(*sql.Selector)
  132. // ByID orders the results by the id field.
  133. func ByID(opts ...sql.OrderTermOption) OrderOption {
  134. return sql.OrderByField(FieldID, opts...).ToFunc()
  135. }
  136. // ByCreatedAt orders the results by the created_at field.
  137. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  138. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  139. }
  140. // ByUpdatedAt orders the results by the updated_at field.
  141. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  142. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  143. }
  144. // ByStatus orders the results by the status field.
  145. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  147. }
  148. // ByDeletedAt orders the results by the deleted_at field.
  149. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  151. }
  152. // ByAk orders the results by the ak field.
  153. func ByAk(opts ...sql.OrderTermOption) OrderOption {
  154. return sql.OrderByField(FieldAk, opts...).ToFunc()
  155. }
  156. // BySk orders the results by the sk field.
  157. func BySk(opts ...sql.OrderTermOption) OrderOption {
  158. return sql.OrderByField(FieldSk, opts...).ToFunc()
  159. }
  160. // ByCallback orders the results by the callback field.
  161. func ByCallback(opts ...sql.OrderTermOption) OrderOption {
  162. return sql.OrderByField(FieldCallback, opts...).ToFunc()
  163. }
  164. // ByAccount orders the results by the account field.
  165. func ByAccount(opts ...sql.OrderTermOption) OrderOption {
  166. return sql.OrderByField(FieldAccount, opts...).ToFunc()
  167. }
  168. // ByNickname orders the results by the nickname field.
  169. func ByNickname(opts ...sql.OrderTermOption) OrderOption {
  170. return sql.OrderByField(FieldNickname, opts...).ToFunc()
  171. }
  172. // ByPhone orders the results by the phone field.
  173. func ByPhone(opts ...sql.OrderTermOption) OrderOption {
  174. return sql.OrderByField(FieldPhone, opts...).ToFunc()
  175. }
  176. // ByOrganizationID orders the results by the organization_id field.
  177. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  178. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  179. }
  180. // ByAgentID orders the results by the agent_id field.
  181. func ByAgentID(opts ...sql.OrderTermOption) OrderOption {
  182. return sql.OrderByField(FieldAgentID, opts...).ToFunc()
  183. }
  184. // ByAPIBase orders the results by the api_base field.
  185. func ByAPIBase(opts ...sql.OrderTermOption) OrderOption {
  186. return sql.OrderByField(FieldAPIBase, opts...).ToFunc()
  187. }
  188. // ByAPIKey orders the results by the api_key field.
  189. func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
  190. return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
  191. }
  192. // ByAgentField orders the results by agent field.
  193. func ByAgentField(field string, opts ...sql.OrderTermOption) OrderOption {
  194. return func(s *sql.Selector) {
  195. sqlgraph.OrderByNeighborTerms(s, newAgentStep(), sql.OrderByField(field, opts...))
  196. }
  197. }
  198. func newAgentStep() *sqlgraph.Step {
  199. return sqlgraph.NewStep(
  200. sqlgraph.From(Table, FieldID),
  201. sqlgraph.To(AgentInverseTable, FieldID),
  202. sqlgraph.Edge(sqlgraph.M2O, true, AgentTable, AgentColumn),
  203. )
  204. }