contact.go 16 KB

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