whatsapp.go 9.4 KB

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