messagerecords.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. // Code generated by ent, DO NOT EDIT.
  2. package messagerecords
  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 messagerecords type in the database.
  11. Label = "message_records"
  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. // FieldBotWxid holds the string denoting the bot_wxid field in the database.
  23. FieldBotWxid = "bot_wxid"
  24. // FieldContactID holds the string denoting the contact_id field in the database.
  25. FieldContactID = "contact_id"
  26. // FieldContactType holds the string denoting the contact_type field in the database.
  27. FieldContactType = "contact_type"
  28. // FieldContactWxid holds the string denoting the contact_wxid field in the database.
  29. FieldContactWxid = "contact_wxid"
  30. // FieldContentType holds the string denoting the content_type field in the database.
  31. FieldContentType = "content_type"
  32. // FieldContent holds the string denoting the content field in the database.
  33. FieldContent = "content"
  34. // FieldMeta holds the string denoting the meta field in the database.
  35. FieldMeta = "meta"
  36. // FieldErrorDetail holds the string denoting the error_detail field in the database.
  37. FieldErrorDetail = "error_detail"
  38. // FieldSendTime holds the string denoting the send_time field in the database.
  39. FieldSendTime = "send_time"
  40. // FieldSourceType holds the string denoting the source_type field in the database.
  41. FieldSourceType = "source_type"
  42. // FieldSourceID holds the string denoting the source_id field in the database.
  43. FieldSourceID = "source_id"
  44. // FieldSubSourceID holds the string denoting the sub_source_id field in the database.
  45. FieldSubSourceID = "sub_source_id"
  46. // EdgeSopStage holds the string denoting the sop_stage edge name in mutations.
  47. EdgeSopStage = "sop_stage"
  48. // EdgeSopNode holds the string denoting the sop_node edge name in mutations.
  49. EdgeSopNode = "sop_node"
  50. // EdgeMessageContact holds the string denoting the message_contact edge name in mutations.
  51. EdgeMessageContact = "message_contact"
  52. // Table holds the table name of the messagerecords in the database.
  53. Table = "message_records"
  54. // SopStageTable is the table that holds the sop_stage relation/edge.
  55. SopStageTable = "message_records"
  56. // SopStageInverseTable is the table name for the SopStage entity.
  57. // It exists in this package in order to avoid circular dependency with the "sopstage" package.
  58. SopStageInverseTable = "sop_stage"
  59. // SopStageColumn is the table column denoting the sop_stage relation/edge.
  60. SopStageColumn = "source_id"
  61. // SopNodeTable is the table that holds the sop_node relation/edge.
  62. SopNodeTable = "message_records"
  63. // SopNodeInverseTable is the table name for the SopNode entity.
  64. // It exists in this package in order to avoid circular dependency with the "sopnode" package.
  65. SopNodeInverseTable = "sop_node"
  66. // SopNodeColumn is the table column denoting the sop_node relation/edge.
  67. SopNodeColumn = "sub_source_id"
  68. // MessageContactTable is the table that holds the message_contact relation/edge.
  69. MessageContactTable = "message_records"
  70. // MessageContactInverseTable is the table name for the Contact entity.
  71. // It exists in this package in order to avoid circular dependency with the "contact" package.
  72. MessageContactInverseTable = "contact"
  73. // MessageContactColumn is the table column denoting the message_contact relation/edge.
  74. MessageContactColumn = "contact_id"
  75. )
  76. // Columns holds all SQL columns for messagerecords fields.
  77. var Columns = []string{
  78. FieldID,
  79. FieldCreatedAt,
  80. FieldUpdatedAt,
  81. FieldStatus,
  82. FieldDeletedAt,
  83. FieldBotWxid,
  84. FieldContactID,
  85. FieldContactType,
  86. FieldContactWxid,
  87. FieldContentType,
  88. FieldContent,
  89. FieldMeta,
  90. FieldErrorDetail,
  91. FieldSendTime,
  92. FieldSourceType,
  93. FieldSourceID,
  94. FieldSubSourceID,
  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. // DefaultContactType holds the default value on creation for the "contact_type" field.
  122. DefaultContactType int
  123. // DefaultContactWxid holds the default value on creation for the "contact_wxid" field.
  124. DefaultContactWxid string
  125. // DefaultContentType holds the default value on creation for the "content_type" field.
  126. DefaultContentType int
  127. // DefaultContent holds the default value on creation for the "content" field.
  128. DefaultContent string
  129. // DefaultErrorDetail holds the default value on creation for the "error_detail" field.
  130. DefaultErrorDetail string
  131. // DefaultSourceType holds the default value on creation for the "source_type" field.
  132. DefaultSourceType int
  133. // DefaultSourceID holds the default value on creation for the "source_id" field.
  134. DefaultSourceID uint64
  135. // DefaultSubSourceID holds the default value on creation for the "sub_source_id" field.
  136. DefaultSubSourceID uint64
  137. )
  138. // OrderOption defines the ordering options for the MessageRecords queries.
  139. type OrderOption func(*sql.Selector)
  140. // ByID orders the results by the id field.
  141. func ByID(opts ...sql.OrderTermOption) OrderOption {
  142. return sql.OrderByField(FieldID, opts...).ToFunc()
  143. }
  144. // ByCreatedAt orders the results by the created_at field.
  145. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  147. }
  148. // ByUpdatedAt orders the results by the updated_at field.
  149. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  151. }
  152. // ByStatus orders the results by the status field.
  153. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  154. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  155. }
  156. // ByDeletedAt orders the results by the deleted_at field.
  157. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  158. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  159. }
  160. // ByBotWxid orders the results by the bot_wxid field.
  161. func ByBotWxid(opts ...sql.OrderTermOption) OrderOption {
  162. return sql.OrderByField(FieldBotWxid, opts...).ToFunc()
  163. }
  164. // ByContactID orders the results by the contact_id field.
  165. func ByContactID(opts ...sql.OrderTermOption) OrderOption {
  166. return sql.OrderByField(FieldContactID, opts...).ToFunc()
  167. }
  168. // ByContactType orders the results by the contact_type field.
  169. func ByContactType(opts ...sql.OrderTermOption) OrderOption {
  170. return sql.OrderByField(FieldContactType, opts...).ToFunc()
  171. }
  172. // ByContactWxid orders the results by the contact_wxid field.
  173. func ByContactWxid(opts ...sql.OrderTermOption) OrderOption {
  174. return sql.OrderByField(FieldContactWxid, opts...).ToFunc()
  175. }
  176. // ByContentType orders the results by the content_type field.
  177. func ByContentType(opts ...sql.OrderTermOption) OrderOption {
  178. return sql.OrderByField(FieldContentType, opts...).ToFunc()
  179. }
  180. // ByContent orders the results by the content field.
  181. func ByContent(opts ...sql.OrderTermOption) OrderOption {
  182. return sql.OrderByField(FieldContent, opts...).ToFunc()
  183. }
  184. // ByErrorDetail orders the results by the error_detail field.
  185. func ByErrorDetail(opts ...sql.OrderTermOption) OrderOption {
  186. return sql.OrderByField(FieldErrorDetail, opts...).ToFunc()
  187. }
  188. // BySendTime orders the results by the send_time field.
  189. func BySendTime(opts ...sql.OrderTermOption) OrderOption {
  190. return sql.OrderByField(FieldSendTime, opts...).ToFunc()
  191. }
  192. // BySourceType orders the results by the source_type field.
  193. func BySourceType(opts ...sql.OrderTermOption) OrderOption {
  194. return sql.OrderByField(FieldSourceType, opts...).ToFunc()
  195. }
  196. // BySourceID orders the results by the source_id field.
  197. func BySourceID(opts ...sql.OrderTermOption) OrderOption {
  198. return sql.OrderByField(FieldSourceID, opts...).ToFunc()
  199. }
  200. // BySubSourceID orders the results by the sub_source_id field.
  201. func BySubSourceID(opts ...sql.OrderTermOption) OrderOption {
  202. return sql.OrderByField(FieldSubSourceID, opts...).ToFunc()
  203. }
  204. // BySopStageField orders the results by sop_stage field.
  205. func BySopStageField(field string, opts ...sql.OrderTermOption) OrderOption {
  206. return func(s *sql.Selector) {
  207. sqlgraph.OrderByNeighborTerms(s, newSopStageStep(), sql.OrderByField(field, opts...))
  208. }
  209. }
  210. // BySopNodeField orders the results by sop_node field.
  211. func BySopNodeField(field string, opts ...sql.OrderTermOption) OrderOption {
  212. return func(s *sql.Selector) {
  213. sqlgraph.OrderByNeighborTerms(s, newSopNodeStep(), sql.OrderByField(field, opts...))
  214. }
  215. }
  216. // ByMessageContactField orders the results by message_contact field.
  217. func ByMessageContactField(field string, opts ...sql.OrderTermOption) OrderOption {
  218. return func(s *sql.Selector) {
  219. sqlgraph.OrderByNeighborTerms(s, newMessageContactStep(), sql.OrderByField(field, opts...))
  220. }
  221. }
  222. func newSopStageStep() *sqlgraph.Step {
  223. return sqlgraph.NewStep(
  224. sqlgraph.From(Table, FieldID),
  225. sqlgraph.To(SopStageInverseTable, FieldID),
  226. sqlgraph.Edge(sqlgraph.M2O, true, SopStageTable, SopStageColumn),
  227. )
  228. }
  229. func newSopNodeStep() *sqlgraph.Step {
  230. return sqlgraph.NewStep(
  231. sqlgraph.From(Table, FieldID),
  232. sqlgraph.To(SopNodeInverseTable, FieldID),
  233. sqlgraph.Edge(sqlgraph.M2O, true, SopNodeTable, SopNodeColumn),
  234. )
  235. }
  236. func newMessageContactStep() *sqlgraph.Step {
  237. return sqlgraph.NewStep(
  238. sqlgraph.From(Table, FieldID),
  239. sqlgraph.To(MessageContactInverseTable, FieldID),
  240. sqlgraph.Edge(sqlgraph.M2O, true, MessageContactTable, MessageContactColumn),
  241. )
  242. }