wx.go 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. // EdgeServer holds the string denoting the server edge name in mutations.
  45. EdgeServer = "server"
  46. // EdgeAgent holds the string denoting the agent edge name in mutations.
  47. EdgeAgent = "agent"
  48. // Table holds the table name of the wx in the database.
  49. Table = "wx"
  50. // ServerTable is the table that holds the server relation/edge.
  51. ServerTable = "wx"
  52. // ServerInverseTable is the table name for the Server entity.
  53. // It exists in this package in order to avoid circular dependency with the "server" package.
  54. ServerInverseTable = "server"
  55. // ServerColumn is the table column denoting the server relation/edge.
  56. ServerColumn = "server_id"
  57. // AgentTable is the table that holds the agent relation/edge.
  58. AgentTable = "wx"
  59. // AgentInverseTable is the table name for the Agent entity.
  60. // It exists in this package in order to avoid circular dependency with the "agent" package.
  61. AgentInverseTable = "agent"
  62. // AgentColumn is the table column denoting the agent relation/edge.
  63. AgentColumn = "agent_id"
  64. )
  65. // Columns holds all SQL columns for wx fields.
  66. var Columns = []string{
  67. FieldID,
  68. FieldCreatedAt,
  69. FieldUpdatedAt,
  70. FieldStatus,
  71. FieldDeletedAt,
  72. FieldServerID,
  73. FieldPort,
  74. FieldProcessID,
  75. FieldCallback,
  76. FieldWxid,
  77. FieldAccount,
  78. FieldNickname,
  79. FieldTel,
  80. FieldHeadBig,
  81. FieldOrganizationID,
  82. FieldAgentID,
  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. // DefaultServerID holds the default value on creation for the "server_id" field.
  110. DefaultServerID uint64
  111. // DefaultPort holds the default value on creation for the "port" field.
  112. DefaultPort string
  113. // DefaultProcessID holds the default value on creation for the "process_id" field.
  114. DefaultProcessID string
  115. // DefaultCallback holds the default value on creation for the "callback" field.
  116. DefaultCallback string
  117. // DefaultWxid holds the default value on creation for the "wxid" field.
  118. DefaultWxid string
  119. // DefaultAccount holds the default value on creation for the "account" field.
  120. DefaultAccount string
  121. // DefaultNickname holds the default value on creation for the "nickname" field.
  122. DefaultNickname string
  123. // DefaultTel holds the default value on creation for the "tel" field.
  124. DefaultTel string
  125. // DefaultHeadBig holds the default value on creation for the "head_big" field.
  126. DefaultHeadBig string
  127. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  128. DefaultOrganizationID uint64
  129. // DefaultAgentID holds the default value on creation for the "agent_id" field.
  130. DefaultAgentID uint64
  131. )
  132. // OrderOption defines the ordering options for the Wx queries.
  133. type OrderOption func(*sql.Selector)
  134. // ByID orders the results by the id field.
  135. func ByID(opts ...sql.OrderTermOption) OrderOption {
  136. return sql.OrderByField(FieldID, opts...).ToFunc()
  137. }
  138. // ByCreatedAt orders the results by the created_at field.
  139. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  140. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  141. }
  142. // ByUpdatedAt orders the results by the updated_at field.
  143. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  144. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  145. }
  146. // ByStatus orders the results by the status field.
  147. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  148. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  149. }
  150. // ByDeletedAt orders the results by the deleted_at field.
  151. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  152. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  153. }
  154. // ByServerID orders the results by the server_id field.
  155. func ByServerID(opts ...sql.OrderTermOption) OrderOption {
  156. return sql.OrderByField(FieldServerID, opts...).ToFunc()
  157. }
  158. // ByPort orders the results by the port field.
  159. func ByPort(opts ...sql.OrderTermOption) OrderOption {
  160. return sql.OrderByField(FieldPort, opts...).ToFunc()
  161. }
  162. // ByProcessID orders the results by the process_id field.
  163. func ByProcessID(opts ...sql.OrderTermOption) OrderOption {
  164. return sql.OrderByField(FieldProcessID, opts...).ToFunc()
  165. }
  166. // ByCallback orders the results by the callback field.
  167. func ByCallback(opts ...sql.OrderTermOption) OrderOption {
  168. return sql.OrderByField(FieldCallback, opts...).ToFunc()
  169. }
  170. // ByWxid orders the results by the wxid field.
  171. func ByWxid(opts ...sql.OrderTermOption) OrderOption {
  172. return sql.OrderByField(FieldWxid, opts...).ToFunc()
  173. }
  174. // ByAccount orders the results by the account field.
  175. func ByAccount(opts ...sql.OrderTermOption) OrderOption {
  176. return sql.OrderByField(FieldAccount, opts...).ToFunc()
  177. }
  178. // ByNickname orders the results by the nickname field.
  179. func ByNickname(opts ...sql.OrderTermOption) OrderOption {
  180. return sql.OrderByField(FieldNickname, opts...).ToFunc()
  181. }
  182. // ByTel orders the results by the tel field.
  183. func ByTel(opts ...sql.OrderTermOption) OrderOption {
  184. return sql.OrderByField(FieldTel, opts...).ToFunc()
  185. }
  186. // ByHeadBig orders the results by the head_big field.
  187. func ByHeadBig(opts ...sql.OrderTermOption) OrderOption {
  188. return sql.OrderByField(FieldHeadBig, opts...).ToFunc()
  189. }
  190. // ByOrganizationID orders the results by the organization_id field.
  191. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  192. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  193. }
  194. // ByAgentID orders the results by the agent_id field.
  195. func ByAgentID(opts ...sql.OrderTermOption) OrderOption {
  196. return sql.OrderByField(FieldAgentID, opts...).ToFunc()
  197. }
  198. // ByServerField orders the results by server field.
  199. func ByServerField(field string, opts ...sql.OrderTermOption) OrderOption {
  200. return func(s *sql.Selector) {
  201. sqlgraph.OrderByNeighborTerms(s, newServerStep(), sql.OrderByField(field, opts...))
  202. }
  203. }
  204. // ByAgentField orders the results by agent field.
  205. func ByAgentField(field string, opts ...sql.OrderTermOption) OrderOption {
  206. return func(s *sql.Selector) {
  207. sqlgraph.OrderByNeighborTerms(s, newAgentStep(), sql.OrderByField(field, opts...))
  208. }
  209. }
  210. func newServerStep() *sqlgraph.Step {
  211. return sqlgraph.NewStep(
  212. sqlgraph.From(Table, FieldID),
  213. sqlgraph.To(ServerInverseTable, FieldID),
  214. sqlgraph.Edge(sqlgraph.M2O, true, ServerTable, ServerColumn),
  215. )
  216. }
  217. func newAgentStep() *sqlgraph.Step {
  218. return sqlgraph.NewStep(
  219. sqlgraph.From(Table, FieldID),
  220. sqlgraph.To(AgentInverseTable, FieldID),
  221. sqlgraph.Edge(sqlgraph.M2O, true, AgentTable, AgentColumn),
  222. )
  223. }