whatsapp.go 8.7 KB

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