wx.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. // Code generated by ent, DO NOT EDIT.
  2. package wx
  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 wx type in the database.
  11. Label = "wx"
  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. // FieldServerID holds the string denoting the server_id field in the database.
  23. FieldServerID = "server_id"
  24. // FieldPort holds the string denoting the port field in the database.
  25. FieldPort = "port"
  26. // FieldProcessID holds the string denoting the process_id field in the database.
  27. FieldProcessID = "process_id"
  28. // FieldCallback holds the string denoting the callback field in the database.
  29. FieldCallback = "callback"
  30. // FieldWxid holds the string denoting the wxid field in the database.
  31. FieldWxid = "wxid"
  32. // FieldAccount holds the string denoting the account field in the database.
  33. FieldAccount = "account"
  34. // FieldNickname holds the string denoting the nickname field in the database.
  35. FieldNickname = "nickname"
  36. // FieldTel holds the string denoting the tel field in the database.
  37. FieldTel = "tel"
  38. // FieldHeadBig holds the string denoting the head_big field in the database.
  39. FieldHeadBig = "head_big"
  40. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  41. FieldOrganizationID = "organization_id"
  42. // FieldAgentID holds the string denoting the agent_id field in the database.
  43. FieldAgentID = "agent_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. // EdgeServer holds the string denoting the server edge name in mutations.
  57. EdgeServer = "server"
  58. // EdgeAgent holds the string denoting the agent edge name in mutations.
  59. EdgeAgent = "agent"
  60. // Table holds the table name of the wx in the database.
  61. Table = "wx"
  62. // ServerTable is the table that holds the server relation/edge.
  63. ServerTable = "wx"
  64. // ServerInverseTable is the table name for the Server entity.
  65. // It exists in this package in order to avoid circular dependency with the "server" package.
  66. ServerInverseTable = "server"
  67. // ServerColumn is the table column denoting the server relation/edge.
  68. ServerColumn = "server_id"
  69. // AgentTable is the table that holds the agent relation/edge.
  70. AgentTable = "wx"
  71. // AgentInverseTable is the table name for the Agent entity.
  72. // It exists in this package in order to avoid circular dependency with the "agent" package.
  73. AgentInverseTable = "agent"
  74. // AgentColumn is the table column denoting the agent relation/edge.
  75. AgentColumn = "agent_id"
  76. )
  77. // Columns holds all SQL columns for wx fields.
  78. var Columns = []string{
  79. FieldID,
  80. FieldCreatedAt,
  81. FieldUpdatedAt,
  82. FieldStatus,
  83. FieldDeletedAt,
  84. FieldServerID,
  85. FieldPort,
  86. FieldProcessID,
  87. FieldCallback,
  88. FieldWxid,
  89. FieldAccount,
  90. FieldNickname,
  91. FieldTel,
  92. FieldHeadBig,
  93. FieldOrganizationID,
  94. FieldAgentID,
  95. FieldAPIBase,
  96. FieldAPIKey,
  97. FieldAllowList,
  98. FieldGroupAllowList,
  99. FieldBlockList,
  100. FieldGroupBlockList,
  101. }
  102. // ForeignKeys holds the SQL foreign-keys that are owned by the "wx"
  103. // table and are not defined as standalone fields in the schema.
  104. var ForeignKeys = []string{
  105. "agent_base_wx_agent",
  106. }
  107. // ValidColumn reports if the column name is valid (part of the table columns).
  108. func ValidColumn(column string) bool {
  109. for i := range Columns {
  110. if column == Columns[i] {
  111. return true
  112. }
  113. }
  114. for i := range ForeignKeys {
  115. if column == ForeignKeys[i] {
  116. return true
  117. }
  118. }
  119. return false
  120. }
  121. // Note that the variables below are initialized by the runtime
  122. // package on the initialization of the application. Therefore,
  123. // it should be imported in the main as follows:
  124. //
  125. // import _ "wechat-api/ent/runtime"
  126. var (
  127. Hooks [1]ent.Hook
  128. Interceptors [1]ent.Interceptor
  129. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  130. DefaultCreatedAt func() time.Time
  131. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  132. DefaultUpdatedAt func() time.Time
  133. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  134. UpdateDefaultUpdatedAt func() time.Time
  135. // DefaultStatus holds the default value on creation for the "status" field.
  136. DefaultStatus uint8
  137. // DefaultServerID holds the default value on creation for the "server_id" field.
  138. DefaultServerID uint64
  139. // DefaultPort holds the default value on creation for the "port" field.
  140. DefaultPort string
  141. // DefaultProcessID holds the default value on creation for the "process_id" field.
  142. DefaultProcessID string
  143. // DefaultCallback holds the default value on creation for the "callback" field.
  144. DefaultCallback string
  145. // DefaultWxid holds the default value on creation for the "wxid" field.
  146. DefaultWxid string
  147. // DefaultAccount holds the default value on creation for the "account" field.
  148. DefaultAccount string
  149. // DefaultNickname holds the default value on creation for the "nickname" field.
  150. DefaultNickname string
  151. // DefaultTel holds the default value on creation for the "tel" field.
  152. DefaultTel string
  153. // DefaultHeadBig holds the default value on creation for the "head_big" field.
  154. DefaultHeadBig string
  155. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  156. DefaultOrganizationID uint64
  157. // DefaultAgentID holds the default value on creation for the "agent_id" field.
  158. DefaultAgentID uint64
  159. // DefaultAPIBase holds the default value on creation for the "api_base" field.
  160. DefaultAPIBase string
  161. // DefaultAPIKey holds the default value on creation for the "api_key" field.
  162. DefaultAPIKey string
  163. )
  164. // OrderOption defines the ordering options for the Wx queries.
  165. type OrderOption func(*sql.Selector)
  166. // ByID orders the results by the id field.
  167. func ByID(opts ...sql.OrderTermOption) OrderOption {
  168. return sql.OrderByField(FieldID, opts...).ToFunc()
  169. }
  170. // ByCreatedAt orders the results by the created_at field.
  171. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  172. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  173. }
  174. // ByUpdatedAt orders the results by the updated_at field.
  175. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  176. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  177. }
  178. // ByStatus orders the results by the status field.
  179. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  180. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  181. }
  182. // ByDeletedAt orders the results by the deleted_at field.
  183. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  184. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  185. }
  186. // ByServerID orders the results by the server_id field.
  187. func ByServerID(opts ...sql.OrderTermOption) OrderOption {
  188. return sql.OrderByField(FieldServerID, opts...).ToFunc()
  189. }
  190. // ByPort orders the results by the port field.
  191. func ByPort(opts ...sql.OrderTermOption) OrderOption {
  192. return sql.OrderByField(FieldPort, opts...).ToFunc()
  193. }
  194. // ByProcessID orders the results by the process_id field.
  195. func ByProcessID(opts ...sql.OrderTermOption) OrderOption {
  196. return sql.OrderByField(FieldProcessID, opts...).ToFunc()
  197. }
  198. // ByCallback orders the results by the callback field.
  199. func ByCallback(opts ...sql.OrderTermOption) OrderOption {
  200. return sql.OrderByField(FieldCallback, opts...).ToFunc()
  201. }
  202. // ByWxid orders the results by the wxid field.
  203. func ByWxid(opts ...sql.OrderTermOption) OrderOption {
  204. return sql.OrderByField(FieldWxid, opts...).ToFunc()
  205. }
  206. // ByAccount orders the results by the account field.
  207. func ByAccount(opts ...sql.OrderTermOption) OrderOption {
  208. return sql.OrderByField(FieldAccount, opts...).ToFunc()
  209. }
  210. // ByNickname orders the results by the nickname field.
  211. func ByNickname(opts ...sql.OrderTermOption) OrderOption {
  212. return sql.OrderByField(FieldNickname, opts...).ToFunc()
  213. }
  214. // ByTel orders the results by the tel field.
  215. func ByTel(opts ...sql.OrderTermOption) OrderOption {
  216. return sql.OrderByField(FieldTel, opts...).ToFunc()
  217. }
  218. // ByHeadBig orders the results by the head_big field.
  219. func ByHeadBig(opts ...sql.OrderTermOption) OrderOption {
  220. return sql.OrderByField(FieldHeadBig, opts...).ToFunc()
  221. }
  222. // ByOrganizationID orders the results by the organization_id field.
  223. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  224. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  225. }
  226. // ByAgentID orders the results by the agent_id field.
  227. func ByAgentID(opts ...sql.OrderTermOption) OrderOption {
  228. return sql.OrderByField(FieldAgentID, opts...).ToFunc()
  229. }
  230. // ByAPIBase orders the results by the api_base field.
  231. func ByAPIBase(opts ...sql.OrderTermOption) OrderOption {
  232. return sql.OrderByField(FieldAPIBase, opts...).ToFunc()
  233. }
  234. // ByAPIKey orders the results by the api_key field.
  235. func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
  236. return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
  237. }
  238. // ByServerField orders the results by server field.
  239. func ByServerField(field string, opts ...sql.OrderTermOption) OrderOption {
  240. return func(s *sql.Selector) {
  241. sqlgraph.OrderByNeighborTerms(s, newServerStep(), sql.OrderByField(field, opts...))
  242. }
  243. }
  244. // ByAgentField orders the results by agent field.
  245. func ByAgentField(field string, opts ...sql.OrderTermOption) OrderOption {
  246. return func(s *sql.Selector) {
  247. sqlgraph.OrderByNeighborTerms(s, newAgentStep(), sql.OrderByField(field, opts...))
  248. }
  249. }
  250. func newServerStep() *sqlgraph.Step {
  251. return sqlgraph.NewStep(
  252. sqlgraph.From(Table, FieldID),
  253. sqlgraph.To(ServerInverseTable, FieldID),
  254. sqlgraph.Edge(sqlgraph.M2O, true, ServerTable, ServerColumn),
  255. )
  256. }
  257. func newAgentStep() *sqlgraph.Step {
  258. return sqlgraph.NewStep(
  259. sqlgraph.From(Table, FieldID),
  260. sqlgraph.To(AgentInverseTable, FieldID),
  261. sqlgraph.Edge(sqlgraph.M2O, true, AgentTable, AgentColumn),
  262. )
  263. }