wx.go 11 KB

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