contact.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  53. FieldOrganizationID = "organization_id"
  54. // FieldCtype holds the string denoting the ctype field in the database.
  55. FieldCtype = "ctype"
  56. // FieldCage holds the string denoting the cage field in the database.
  57. FieldCage = "cage"
  58. // FieldCname holds the string denoting the cname field in the database.
  59. FieldCname = "cname"
  60. // FieldCarea holds the string denoting the carea field in the database.
  61. FieldCarea = "carea"
  62. // FieldCbirthday holds the string denoting the cbirthday field in the database.
  63. FieldCbirthday = "cbirthday"
  64. // FieldCbirtharea holds the string denoting the cbirtharea field in the database.
  65. FieldCbirtharea = "cbirtharea"
  66. // FieldCidcardNo holds the string denoting the cidcard_no field in the database.
  67. FieldCidcardNo = "cidcard_no"
  68. // FieldCtitle holds the string denoting the ctitle field in the database.
  69. FieldCtitle = "ctitle"
  70. // FieldCc holds the string denoting the cc field in the database.
  71. FieldCc = "cc"
  72. // FieldPhone holds the string denoting the phone field in the database.
  73. FieldPhone = "phone"
  74. // EdgeContactRelationships holds the string denoting the contact_relationships edge name in mutations.
  75. EdgeContactRelationships = "contact_relationships"
  76. // EdgeContactMessages holds the string denoting the contact_messages edge name in mutations.
  77. EdgeContactMessages = "contact_messages"
  78. // Table holds the table name of the contact in the database.
  79. Table = "contact"
  80. // ContactRelationshipsTable is the table that holds the contact_relationships relation/edge.
  81. ContactRelationshipsTable = "label_relationship"
  82. // ContactRelationshipsInverseTable is the table name for the LabelRelationship entity.
  83. // It exists in this package in order to avoid circular dependency with the "labelrelationship" package.
  84. ContactRelationshipsInverseTable = "label_relationship"
  85. // ContactRelationshipsColumn is the table column denoting the contact_relationships relation/edge.
  86. ContactRelationshipsColumn = "contact_id"
  87. // ContactMessagesTable is the table that holds the contact_messages relation/edge.
  88. ContactMessagesTable = "message_records"
  89. // ContactMessagesInverseTable is the table name for the MessageRecords entity.
  90. // It exists in this package in order to avoid circular dependency with the "messagerecords" package.
  91. ContactMessagesInverseTable = "message_records"
  92. // ContactMessagesColumn is the table column denoting the contact_messages relation/edge.
  93. ContactMessagesColumn = "contact_id"
  94. )
  95. // Columns holds all SQL columns for contact fields.
  96. var Columns = []string{
  97. FieldID,
  98. FieldCreatedAt,
  99. FieldUpdatedAt,
  100. FieldStatus,
  101. FieldDeletedAt,
  102. FieldWxWxid,
  103. FieldType,
  104. FieldWxid,
  105. FieldAccount,
  106. FieldNickname,
  107. FieldMarkname,
  108. FieldHeadimg,
  109. FieldSex,
  110. FieldStarrole,
  111. FieldDontseeit,
  112. FieldDontseeme,
  113. FieldLag,
  114. FieldGid,
  115. FieldGname,
  116. FieldV3,
  117. FieldOrganizationID,
  118. FieldCtype,
  119. FieldCage,
  120. FieldCname,
  121. FieldCarea,
  122. FieldCbirthday,
  123. FieldCbirtharea,
  124. FieldCidcardNo,
  125. FieldCtitle,
  126. FieldCc,
  127. FieldPhone,
  128. }
  129. // ValidColumn reports if the column name is valid (part of the table columns).
  130. func ValidColumn(column string) bool {
  131. for i := range Columns {
  132. if column == Columns[i] {
  133. return true
  134. }
  135. }
  136. return false
  137. }
  138. // Note that the variables below are initialized by the runtime
  139. // package on the initialization of the application. Therefore,
  140. // it should be imported in the main as follows:
  141. //
  142. // import _ "wechat-api/ent/runtime"
  143. var (
  144. Hooks [1]ent.Hook
  145. Interceptors [1]ent.Interceptor
  146. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  147. DefaultCreatedAt func() time.Time
  148. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  149. DefaultUpdatedAt func() time.Time
  150. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  151. UpdateDefaultUpdatedAt func() time.Time
  152. // DefaultStatus holds the default value on creation for the "status" field.
  153. DefaultStatus uint8
  154. // DefaultWxWxid holds the default value on creation for the "wx_wxid" field.
  155. DefaultWxWxid string
  156. // DefaultType holds the default value on creation for the "type" field.
  157. DefaultType int
  158. // DefaultWxid holds the default value on creation for the "wxid" field.
  159. DefaultWxid string
  160. // DefaultAccount holds the default value on creation for the "account" field.
  161. DefaultAccount string
  162. // DefaultNickname holds the default value on creation for the "nickname" field.
  163. DefaultNickname string
  164. // DefaultMarkname holds the default value on creation for the "markname" field.
  165. DefaultMarkname string
  166. // DefaultHeadimg holds the default value on creation for the "headimg" field.
  167. DefaultHeadimg string
  168. // DefaultSex holds the default value on creation for the "sex" field.
  169. DefaultSex int
  170. // DefaultStarrole holds the default value on creation for the "starrole" field.
  171. DefaultStarrole string
  172. // DefaultDontseeit holds the default value on creation for the "dontseeit" field.
  173. DefaultDontseeit int
  174. // DefaultDontseeme holds the default value on creation for the "dontseeme" field.
  175. DefaultDontseeme int
  176. // DefaultLag holds the default value on creation for the "lag" field.
  177. DefaultLag string
  178. // DefaultGid holds the default value on creation for the "gid" field.
  179. DefaultGid string
  180. // DefaultGname holds the default value on creation for the "gname" field.
  181. DefaultGname string
  182. // DefaultV3 holds the default value on creation for the "v3" field.
  183. DefaultV3 string
  184. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  185. DefaultOrganizationID uint64
  186. // DefaultCtype holds the default value on creation for the "ctype" field.
  187. DefaultCtype uint64
  188. // DefaultCage holds the default value on creation for the "cage" field.
  189. DefaultCage int
  190. // DefaultCname holds the default value on creation for the "cname" field.
  191. DefaultCname string
  192. // DefaultCarea holds the default value on creation for the "carea" field.
  193. DefaultCarea string
  194. // DefaultCbirthday holds the default value on creation for the "cbirthday" field.
  195. DefaultCbirthday string
  196. // DefaultCbirtharea holds the default value on creation for the "cbirtharea" field.
  197. DefaultCbirtharea string
  198. // DefaultCidcardNo holds the default value on creation for the "cidcard_no" field.
  199. DefaultCidcardNo string
  200. // DefaultCtitle holds the default value on creation for the "ctitle" field.
  201. DefaultCtitle string
  202. // DefaultCc holds the default value on creation for the "cc" field.
  203. DefaultCc string
  204. // DefaultPhone holds the default value on creation for the "phone" field.
  205. DefaultPhone string
  206. )
  207. // OrderOption defines the ordering options for the Contact queries.
  208. type OrderOption func(*sql.Selector)
  209. // ByID orders the results by the id field.
  210. func ByID(opts ...sql.OrderTermOption) OrderOption {
  211. return sql.OrderByField(FieldID, opts...).ToFunc()
  212. }
  213. // ByCreatedAt orders the results by the created_at field.
  214. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  215. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  216. }
  217. // ByUpdatedAt orders the results by the updated_at field.
  218. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  219. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  220. }
  221. // ByStatus orders the results by the status field.
  222. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  223. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  224. }
  225. // ByDeletedAt orders the results by the deleted_at field.
  226. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  227. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  228. }
  229. // ByWxWxid orders the results by the wx_wxid field.
  230. func ByWxWxid(opts ...sql.OrderTermOption) OrderOption {
  231. return sql.OrderByField(FieldWxWxid, opts...).ToFunc()
  232. }
  233. // ByType orders the results by the type field.
  234. func ByType(opts ...sql.OrderTermOption) OrderOption {
  235. return sql.OrderByField(FieldType, opts...).ToFunc()
  236. }
  237. // ByWxid orders the results by the wxid field.
  238. func ByWxid(opts ...sql.OrderTermOption) OrderOption {
  239. return sql.OrderByField(FieldWxid, opts...).ToFunc()
  240. }
  241. // ByAccount orders the results by the account field.
  242. func ByAccount(opts ...sql.OrderTermOption) OrderOption {
  243. return sql.OrderByField(FieldAccount, opts...).ToFunc()
  244. }
  245. // ByNickname orders the results by the nickname field.
  246. func ByNickname(opts ...sql.OrderTermOption) OrderOption {
  247. return sql.OrderByField(FieldNickname, opts...).ToFunc()
  248. }
  249. // ByMarkname orders the results by the markname field.
  250. func ByMarkname(opts ...sql.OrderTermOption) OrderOption {
  251. return sql.OrderByField(FieldMarkname, opts...).ToFunc()
  252. }
  253. // ByHeadimg orders the results by the headimg field.
  254. func ByHeadimg(opts ...sql.OrderTermOption) OrderOption {
  255. return sql.OrderByField(FieldHeadimg, opts...).ToFunc()
  256. }
  257. // BySex orders the results by the sex field.
  258. func BySex(opts ...sql.OrderTermOption) OrderOption {
  259. return sql.OrderByField(FieldSex, opts...).ToFunc()
  260. }
  261. // ByStarrole orders the results by the starrole field.
  262. func ByStarrole(opts ...sql.OrderTermOption) OrderOption {
  263. return sql.OrderByField(FieldStarrole, opts...).ToFunc()
  264. }
  265. // ByDontseeit orders the results by the dontseeit field.
  266. func ByDontseeit(opts ...sql.OrderTermOption) OrderOption {
  267. return sql.OrderByField(FieldDontseeit, opts...).ToFunc()
  268. }
  269. // ByDontseeme orders the results by the dontseeme field.
  270. func ByDontseeme(opts ...sql.OrderTermOption) OrderOption {
  271. return sql.OrderByField(FieldDontseeme, opts...).ToFunc()
  272. }
  273. // ByLag orders the results by the lag field.
  274. func ByLag(opts ...sql.OrderTermOption) OrderOption {
  275. return sql.OrderByField(FieldLag, opts...).ToFunc()
  276. }
  277. // ByGid orders the results by the gid field.
  278. func ByGid(opts ...sql.OrderTermOption) OrderOption {
  279. return sql.OrderByField(FieldGid, opts...).ToFunc()
  280. }
  281. // ByGname orders the results by the gname field.
  282. func ByGname(opts ...sql.OrderTermOption) OrderOption {
  283. return sql.OrderByField(FieldGname, opts...).ToFunc()
  284. }
  285. // ByV3 orders the results by the v3 field.
  286. func ByV3(opts ...sql.OrderTermOption) OrderOption {
  287. return sql.OrderByField(FieldV3, opts...).ToFunc()
  288. }
  289. // ByOrganizationID orders the results by the organization_id field.
  290. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  291. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  292. }
  293. // ByCtype orders the results by the ctype field.
  294. func ByCtype(opts ...sql.OrderTermOption) OrderOption {
  295. return sql.OrderByField(FieldCtype, opts...).ToFunc()
  296. }
  297. // ByCage orders the results by the cage field.
  298. func ByCage(opts ...sql.OrderTermOption) OrderOption {
  299. return sql.OrderByField(FieldCage, opts...).ToFunc()
  300. }
  301. // ByCname orders the results by the cname field.
  302. func ByCname(opts ...sql.OrderTermOption) OrderOption {
  303. return sql.OrderByField(FieldCname, opts...).ToFunc()
  304. }
  305. // ByCarea orders the results by the carea field.
  306. func ByCarea(opts ...sql.OrderTermOption) OrderOption {
  307. return sql.OrderByField(FieldCarea, opts...).ToFunc()
  308. }
  309. // ByCbirthday orders the results by the cbirthday field.
  310. func ByCbirthday(opts ...sql.OrderTermOption) OrderOption {
  311. return sql.OrderByField(FieldCbirthday, opts...).ToFunc()
  312. }
  313. // ByCbirtharea orders the results by the cbirtharea field.
  314. func ByCbirtharea(opts ...sql.OrderTermOption) OrderOption {
  315. return sql.OrderByField(FieldCbirtharea, opts...).ToFunc()
  316. }
  317. // ByCidcardNo orders the results by the cidcard_no field.
  318. func ByCidcardNo(opts ...sql.OrderTermOption) OrderOption {
  319. return sql.OrderByField(FieldCidcardNo, opts...).ToFunc()
  320. }
  321. // ByCtitle orders the results by the ctitle field.
  322. func ByCtitle(opts ...sql.OrderTermOption) OrderOption {
  323. return sql.OrderByField(FieldCtitle, opts...).ToFunc()
  324. }
  325. // ByCc orders the results by the cc field.
  326. func ByCc(opts ...sql.OrderTermOption) OrderOption {
  327. return sql.OrderByField(FieldCc, opts...).ToFunc()
  328. }
  329. // ByPhone orders the results by the phone field.
  330. func ByPhone(opts ...sql.OrderTermOption) OrderOption {
  331. return sql.OrderByField(FieldPhone, opts...).ToFunc()
  332. }
  333. // ByContactRelationshipsCount orders the results by contact_relationships count.
  334. func ByContactRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
  335. return func(s *sql.Selector) {
  336. sqlgraph.OrderByNeighborsCount(s, newContactRelationshipsStep(), opts...)
  337. }
  338. }
  339. // ByContactRelationships orders the results by contact_relationships terms.
  340. func ByContactRelationships(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  341. return func(s *sql.Selector) {
  342. sqlgraph.OrderByNeighborTerms(s, newContactRelationshipsStep(), append([]sql.OrderTerm{term}, terms...)...)
  343. }
  344. }
  345. // ByContactMessagesCount orders the results by contact_messages count.
  346. func ByContactMessagesCount(opts ...sql.OrderTermOption) OrderOption {
  347. return func(s *sql.Selector) {
  348. sqlgraph.OrderByNeighborsCount(s, newContactMessagesStep(), opts...)
  349. }
  350. }
  351. // ByContactMessages orders the results by contact_messages terms.
  352. func ByContactMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  353. return func(s *sql.Selector) {
  354. sqlgraph.OrderByNeighborTerms(s, newContactMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
  355. }
  356. }
  357. func newContactRelationshipsStep() *sqlgraph.Step {
  358. return sqlgraph.NewStep(
  359. sqlgraph.From(Table, FieldID),
  360. sqlgraph.To(ContactRelationshipsInverseTable, FieldID),
  361. sqlgraph.Edge(sqlgraph.O2M, false, ContactRelationshipsTable, ContactRelationshipsColumn),
  362. )
  363. }
  364. func newContactMessagesStep() *sqlgraph.Step {
  365. return sqlgraph.NewStep(
  366. sqlgraph.From(Table, FieldID),
  367. sqlgraph.To(ContactMessagesInverseTable, FieldID),
  368. sqlgraph.Edge(sqlgraph.O2M, false, ContactMessagesTable, ContactMessagesColumn),
  369. )
  370. }