contact.go 12 KB

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