contact.go 17 KB

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