wx.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. // EdgeServer holds the string denoting the server edge name in mutations.
  41. EdgeServer = "server"
  42. // Table holds the table name of the wx in the database.
  43. Table = "wx"
  44. // ServerTable is the table that holds the server relation/edge.
  45. ServerTable = "wx"
  46. // ServerInverseTable is the table name for the Server entity.
  47. // It exists in this package in order to avoid circular dependency with the "server" package.
  48. ServerInverseTable = "server"
  49. // ServerColumn is the table column denoting the server relation/edge.
  50. ServerColumn = "server_id"
  51. )
  52. // Columns holds all SQL columns for wx fields.
  53. var Columns = []string{
  54. FieldID,
  55. FieldCreatedAt,
  56. FieldUpdatedAt,
  57. FieldStatus,
  58. FieldDeletedAt,
  59. FieldServerID,
  60. FieldPort,
  61. FieldProcessID,
  62. FieldCallback,
  63. FieldWxid,
  64. FieldAccount,
  65. FieldNickname,
  66. FieldTel,
  67. FieldHeadBig,
  68. }
  69. // ValidColumn reports if the column name is valid (part of the table columns).
  70. func ValidColumn(column string) bool {
  71. for i := range Columns {
  72. if column == Columns[i] {
  73. return true
  74. }
  75. }
  76. return false
  77. }
  78. // Note that the variables below are initialized by the runtime
  79. // package on the initialization of the application. Therefore,
  80. // it should be imported in the main as follows:
  81. //
  82. // import _ "wechat-api/ent/runtime"
  83. var (
  84. Hooks [1]ent.Hook
  85. Interceptors [1]ent.Interceptor
  86. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  87. DefaultCreatedAt func() time.Time
  88. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  89. DefaultUpdatedAt func() time.Time
  90. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  91. UpdateDefaultUpdatedAt func() time.Time
  92. // DefaultStatus holds the default value on creation for the "status" field.
  93. DefaultStatus uint8
  94. // DefaultServerID holds the default value on creation for the "server_id" field.
  95. DefaultServerID uint64
  96. // DefaultPort holds the default value on creation for the "port" field.
  97. DefaultPort string
  98. // DefaultProcessID holds the default value on creation for the "process_id" field.
  99. DefaultProcessID string
  100. // DefaultCallback holds the default value on creation for the "callback" field.
  101. DefaultCallback string
  102. // DefaultWxid holds the default value on creation for the "wxid" field.
  103. DefaultWxid string
  104. // DefaultAccount holds the default value on creation for the "account" field.
  105. DefaultAccount string
  106. // DefaultNickname holds the default value on creation for the "nickname" field.
  107. DefaultNickname string
  108. // DefaultTel holds the default value on creation for the "tel" field.
  109. DefaultTel string
  110. // DefaultHeadBig holds the default value on creation for the "head_big" field.
  111. DefaultHeadBig string
  112. )
  113. // OrderOption defines the ordering options for the Wx queries.
  114. type OrderOption func(*sql.Selector)
  115. // ByID orders the results by the id field.
  116. func ByID(opts ...sql.OrderTermOption) OrderOption {
  117. return sql.OrderByField(FieldID, opts...).ToFunc()
  118. }
  119. // ByCreatedAt orders the results by the created_at field.
  120. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  121. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  122. }
  123. // ByUpdatedAt orders the results by the updated_at field.
  124. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  125. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  126. }
  127. // ByStatus orders the results by the status field.
  128. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  129. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  130. }
  131. // ByDeletedAt orders the results by the deleted_at field.
  132. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  133. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  134. }
  135. // ByServerID orders the results by the server_id field.
  136. func ByServerID(opts ...sql.OrderTermOption) OrderOption {
  137. return sql.OrderByField(FieldServerID, opts...).ToFunc()
  138. }
  139. // ByPort orders the results by the port field.
  140. func ByPort(opts ...sql.OrderTermOption) OrderOption {
  141. return sql.OrderByField(FieldPort, opts...).ToFunc()
  142. }
  143. // ByProcessID orders the results by the process_id field.
  144. func ByProcessID(opts ...sql.OrderTermOption) OrderOption {
  145. return sql.OrderByField(FieldProcessID, opts...).ToFunc()
  146. }
  147. // ByCallback orders the results by the callback field.
  148. func ByCallback(opts ...sql.OrderTermOption) OrderOption {
  149. return sql.OrderByField(FieldCallback, opts...).ToFunc()
  150. }
  151. // ByWxid orders the results by the wxid field.
  152. func ByWxid(opts ...sql.OrderTermOption) OrderOption {
  153. return sql.OrderByField(FieldWxid, opts...).ToFunc()
  154. }
  155. // ByAccount orders the results by the account field.
  156. func ByAccount(opts ...sql.OrderTermOption) OrderOption {
  157. return sql.OrderByField(FieldAccount, opts...).ToFunc()
  158. }
  159. // ByNickname orders the results by the nickname field.
  160. func ByNickname(opts ...sql.OrderTermOption) OrderOption {
  161. return sql.OrderByField(FieldNickname, opts...).ToFunc()
  162. }
  163. // ByTel orders the results by the tel field.
  164. func ByTel(opts ...sql.OrderTermOption) OrderOption {
  165. return sql.OrderByField(FieldTel, opts...).ToFunc()
  166. }
  167. // ByHeadBig orders the results by the head_big field.
  168. func ByHeadBig(opts ...sql.OrderTermOption) OrderOption {
  169. return sql.OrderByField(FieldHeadBig, opts...).ToFunc()
  170. }
  171. // ByServerField orders the results by server field.
  172. func ByServerField(field string, opts ...sql.OrderTermOption) OrderOption {
  173. return func(s *sql.Selector) {
  174. sqlgraph.OrderByNeighborTerms(s, newServerStep(), sql.OrderByField(field, opts...))
  175. }
  176. }
  177. func newServerStep() *sqlgraph.Step {
  178. return sqlgraph.NewStep(
  179. sqlgraph.From(Table, FieldID),
  180. sqlgraph.To(ServerInverseTable, FieldID),
  181. sqlgraph.Edge(sqlgraph.M2O, true, ServerTable, ServerColumn),
  182. )
  183. }