contact.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. // Code generated by ent, DO NOT EDIT.
  2. package contact
  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 contact type in the database.
  11. Label = "contact"
  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. // FieldWxWxid holds the string denoting the wx_wxid field in the database.
  23. FieldWxWxid = "wx_wxid"
  24. // FieldType holds the string denoting the type field in the database.
  25. FieldType = "type"
  26. // FieldWxid holds the string denoting the wxid field in the database.
  27. FieldWxid = "wxid"
  28. // FieldAccount holds the string denoting the account field in the database.
  29. FieldAccount = "account"
  30. // FieldNickname holds the string denoting the nickname field in the database.
  31. FieldNickname = "nickname"
  32. // FieldMarkname holds the string denoting the markname field in the database.
  33. FieldMarkname = "markname"
  34. // FieldHeadimg holds the string denoting the headimg field in the database.
  35. FieldHeadimg = "headimg"
  36. // FieldSex holds the string denoting the sex field in the database.
  37. FieldSex = "sex"
  38. // FieldStarrole holds the string denoting the starrole field in the database.
  39. FieldStarrole = "starrole"
  40. // FieldDontseeit holds the string denoting the dontseeit field in the database.
  41. FieldDontseeit = "dontseeit"
  42. // FieldDontseeme holds the string denoting the dontseeme field in the database.
  43. FieldDontseeme = "dontseeme"
  44. // FieldLag holds the string denoting the lag field in the database.
  45. FieldLag = "lag"
  46. // FieldGid holds the string denoting the gid field in the database.
  47. FieldGid = "gid"
  48. // FieldGname holds the string denoting the gname field in the database.
  49. FieldGname = "gname"
  50. // FieldV3 holds the string denoting the v3 field in the database.
  51. FieldV3 = "v3"
  52. // EdgeContactRelationships holds the string denoting the contact_relationships edge name in mutations.
  53. EdgeContactRelationships = "contact_relationships"
  54. // EdgeContactMessages holds the string denoting the contact_messages edge name in mutations.
  55. EdgeContactMessages = "contact_messages"
  56. // Table holds the table name of the contact in the database.
  57. Table = "contact"
  58. // ContactRelationshipsTable is the table that holds the contact_relationships relation/edge.
  59. ContactRelationshipsTable = "label_relationship"
  60. // ContactRelationshipsInverseTable is the table name for the LabelRelationship entity.
  61. // It exists in this package in order to avoid circular dependency with the "labelrelationship" package.
  62. ContactRelationshipsInverseTable = "label_relationship"
  63. // ContactRelationshipsColumn is the table column denoting the contact_relationships relation/edge.
  64. ContactRelationshipsColumn = "contact_id"
  65. // ContactMessagesTable is the table that holds the contact_messages relation/edge.
  66. ContactMessagesTable = "message_records"
  67. // ContactMessagesInverseTable is the table name for the MessageRecords entity.
  68. // It exists in this package in order to avoid circular dependency with the "messagerecords" package.
  69. ContactMessagesInverseTable = "message_records"
  70. // ContactMessagesColumn is the table column denoting the contact_messages relation/edge.
  71. ContactMessagesColumn = "contact_id"
  72. )
  73. // Columns holds all SQL columns for contact fields.
  74. var Columns = []string{
  75. FieldID,
  76. FieldCreatedAt,
  77. FieldUpdatedAt,
  78. FieldStatus,
  79. FieldDeletedAt,
  80. FieldWxWxid,
  81. FieldType,
  82. FieldWxid,
  83. FieldAccount,
  84. FieldNickname,
  85. FieldMarkname,
  86. FieldHeadimg,
  87. FieldSex,
  88. FieldStarrole,
  89. FieldDontseeit,
  90. FieldDontseeme,
  91. FieldLag,
  92. FieldGid,
  93. FieldGname,
  94. FieldV3,
  95. }
  96. // ValidColumn reports if the column name is valid (part of the table columns).
  97. func ValidColumn(column string) bool {
  98. for i := range Columns {
  99. if column == Columns[i] {
  100. return true
  101. }
  102. }
  103. return false
  104. }
  105. // Note that the variables below are initialized by the runtime
  106. // package on the initialization of the application. Therefore,
  107. // it should be imported in the main as follows:
  108. //
  109. // import _ "wechat-api/ent/runtime"
  110. var (
  111. Hooks [1]ent.Hook
  112. Interceptors [1]ent.Interceptor
  113. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  114. DefaultCreatedAt func() time.Time
  115. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  116. DefaultUpdatedAt func() time.Time
  117. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  118. UpdateDefaultUpdatedAt func() time.Time
  119. // DefaultStatus holds the default value on creation for the "status" field.
  120. DefaultStatus uint8
  121. // DefaultWxWxid holds the default value on creation for the "wx_wxid" field.
  122. DefaultWxWxid string
  123. // DefaultType holds the default value on creation for the "type" field.
  124. DefaultType int
  125. // DefaultWxid holds the default value on creation for the "wxid" field.
  126. DefaultWxid string
  127. // DefaultAccount holds the default value on creation for the "account" field.
  128. DefaultAccount string
  129. // DefaultNickname holds the default value on creation for the "nickname" field.
  130. DefaultNickname string
  131. // DefaultMarkname holds the default value on creation for the "markname" field.
  132. DefaultMarkname string
  133. // DefaultHeadimg holds the default value on creation for the "headimg" field.
  134. DefaultHeadimg string
  135. // DefaultSex holds the default value on creation for the "sex" field.
  136. DefaultSex int
  137. // DefaultStarrole holds the default value on creation for the "starrole" field.
  138. DefaultStarrole string
  139. // DefaultDontseeit holds the default value on creation for the "dontseeit" field.
  140. DefaultDontseeit int
  141. // DefaultDontseeme holds the default value on creation for the "dontseeme" field.
  142. DefaultDontseeme int
  143. // DefaultLag holds the default value on creation for the "lag" field.
  144. DefaultLag string
  145. // DefaultGid holds the default value on creation for the "gid" field.
  146. DefaultGid string
  147. // DefaultGname holds the default value on creation for the "gname" field.
  148. DefaultGname string
  149. // DefaultV3 holds the default value on creation for the "v3" field.
  150. DefaultV3 string
  151. )
  152. // OrderOption defines the ordering options for the Contact queries.
  153. type OrderOption func(*sql.Selector)
  154. // ByID orders the results by the id field.
  155. func ByID(opts ...sql.OrderTermOption) OrderOption {
  156. return sql.OrderByField(FieldID, opts...).ToFunc()
  157. }
  158. // ByCreatedAt orders the results by the created_at field.
  159. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  160. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  161. }
  162. // ByUpdatedAt orders the results by the updated_at field.
  163. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  164. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  165. }
  166. // ByStatus orders the results by the status field.
  167. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  168. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  169. }
  170. // ByDeletedAt orders the results by the deleted_at field.
  171. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  172. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  173. }
  174. // ByWxWxid orders the results by the wx_wxid field.
  175. func ByWxWxid(opts ...sql.OrderTermOption) OrderOption {
  176. return sql.OrderByField(FieldWxWxid, opts...).ToFunc()
  177. }
  178. // ByType orders the results by the type field.
  179. func ByType(opts ...sql.OrderTermOption) OrderOption {
  180. return sql.OrderByField(FieldType, opts...).ToFunc()
  181. }
  182. // ByWxid orders the results by the wxid field.
  183. func ByWxid(opts ...sql.OrderTermOption) OrderOption {
  184. return sql.OrderByField(FieldWxid, opts...).ToFunc()
  185. }
  186. // ByAccount orders the results by the account field.
  187. func ByAccount(opts ...sql.OrderTermOption) OrderOption {
  188. return sql.OrderByField(FieldAccount, opts...).ToFunc()
  189. }
  190. // ByNickname orders the results by the nickname field.
  191. func ByNickname(opts ...sql.OrderTermOption) OrderOption {
  192. return sql.OrderByField(FieldNickname, opts...).ToFunc()
  193. }
  194. // ByMarkname orders the results by the markname field.
  195. func ByMarkname(opts ...sql.OrderTermOption) OrderOption {
  196. return sql.OrderByField(FieldMarkname, opts...).ToFunc()
  197. }
  198. // ByHeadimg orders the results by the headimg field.
  199. func ByHeadimg(opts ...sql.OrderTermOption) OrderOption {
  200. return sql.OrderByField(FieldHeadimg, opts...).ToFunc()
  201. }
  202. // BySex orders the results by the sex field.
  203. func BySex(opts ...sql.OrderTermOption) OrderOption {
  204. return sql.OrderByField(FieldSex, opts...).ToFunc()
  205. }
  206. // ByStarrole orders the results by the starrole field.
  207. func ByStarrole(opts ...sql.OrderTermOption) OrderOption {
  208. return sql.OrderByField(FieldStarrole, opts...).ToFunc()
  209. }
  210. // ByDontseeit orders the results by the dontseeit field.
  211. func ByDontseeit(opts ...sql.OrderTermOption) OrderOption {
  212. return sql.OrderByField(FieldDontseeit, opts...).ToFunc()
  213. }
  214. // ByDontseeme orders the results by the dontseeme field.
  215. func ByDontseeme(opts ...sql.OrderTermOption) OrderOption {
  216. return sql.OrderByField(FieldDontseeme, opts...).ToFunc()
  217. }
  218. // ByLag orders the results by the lag field.
  219. func ByLag(opts ...sql.OrderTermOption) OrderOption {
  220. return sql.OrderByField(FieldLag, opts...).ToFunc()
  221. }
  222. // ByGid orders the results by the gid field.
  223. func ByGid(opts ...sql.OrderTermOption) OrderOption {
  224. return sql.OrderByField(FieldGid, opts...).ToFunc()
  225. }
  226. // ByGname orders the results by the gname field.
  227. func ByGname(opts ...sql.OrderTermOption) OrderOption {
  228. return sql.OrderByField(FieldGname, opts...).ToFunc()
  229. }
  230. // ByV3 orders the results by the v3 field.
  231. func ByV3(opts ...sql.OrderTermOption) OrderOption {
  232. return sql.OrderByField(FieldV3, opts...).ToFunc()
  233. }
  234. // ByContactRelationshipsCount orders the results by contact_relationships count.
  235. func ByContactRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
  236. return func(s *sql.Selector) {
  237. sqlgraph.OrderByNeighborsCount(s, newContactRelationshipsStep(), opts...)
  238. }
  239. }
  240. // ByContactRelationships orders the results by contact_relationships terms.
  241. func ByContactRelationships(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  242. return func(s *sql.Selector) {
  243. sqlgraph.OrderByNeighborTerms(s, newContactRelationshipsStep(), append([]sql.OrderTerm{term}, terms...)...)
  244. }
  245. }
  246. // ByContactMessagesCount orders the results by contact_messages count.
  247. func ByContactMessagesCount(opts ...sql.OrderTermOption) OrderOption {
  248. return func(s *sql.Selector) {
  249. sqlgraph.OrderByNeighborsCount(s, newContactMessagesStep(), opts...)
  250. }
  251. }
  252. // ByContactMessages orders the results by contact_messages terms.
  253. func ByContactMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  254. return func(s *sql.Selector) {
  255. sqlgraph.OrderByNeighborTerms(s, newContactMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
  256. }
  257. }
  258. func newContactRelationshipsStep() *sqlgraph.Step {
  259. return sqlgraph.NewStep(
  260. sqlgraph.From(Table, FieldID),
  261. sqlgraph.To(ContactRelationshipsInverseTable, FieldID),
  262. sqlgraph.Edge(sqlgraph.O2M, false, ContactRelationshipsTable, ContactRelationshipsColumn),
  263. )
  264. }
  265. func newContactMessagesStep() *sqlgraph.Step {
  266. return sqlgraph.NewStep(
  267. sqlgraph.From(Table, FieldID),
  268. sqlgraph.To(ContactMessagesInverseTable, FieldID),
  269. sqlgraph.Edge(sqlgraph.O2M, false, ContactMessagesTable, ContactMessagesColumn),
  270. )
  271. }