messagerecords.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. // FieldErrorDetail holds the string denoting the error_detail field in the database.
  35. FieldErrorDetail = "error_detail"
  36. // FieldSendTime holds the string denoting the send_time field in the database.
  37. FieldSendTime = "send_time"
  38. // FieldSourceType holds the string denoting the source_type field in the database.
  39. FieldSourceType = "source_type"
  40. // FieldSourceID holds the string denoting the source_id field in the database.
  41. FieldSourceID = "source_id"
  42. // FieldSubSourceID holds the string denoting the sub_source_id field in the database.
  43. FieldSubSourceID = "sub_source_id"
  44. // EdgeSopStage holds the string denoting the sop_stage edge name in mutations.
  45. EdgeSopStage = "sop_stage"
  46. // EdgeSopNode holds the string denoting the sop_node edge name in mutations.
  47. EdgeSopNode = "sop_node"
  48. // EdgeMessageContact holds the string denoting the message_contact edge name in mutations.
  49. EdgeMessageContact = "message_contact"
  50. // Table holds the table name of the messagerecords in the database.
  51. Table = "message_records"
  52. // SopStageTable is the table that holds the sop_stage relation/edge.
  53. SopStageTable = "message_records"
  54. // SopStageInverseTable is the table name for the SopStage entity.
  55. // It exists in this package in order to avoid circular dependency with the "sopstage" package.
  56. SopStageInverseTable = "sop_stage"
  57. // SopStageColumn is the table column denoting the sop_stage relation/edge.
  58. SopStageColumn = "source_id"
  59. // SopNodeTable is the table that holds the sop_node relation/edge.
  60. SopNodeTable = "message_records"
  61. // SopNodeInverseTable is the table name for the SopNode entity.
  62. // It exists in this package in order to avoid circular dependency with the "sopnode" package.
  63. SopNodeInverseTable = "sop_node"
  64. // SopNodeColumn is the table column denoting the sop_node relation/edge.
  65. SopNodeColumn = "sub_source_id"
  66. // MessageContactTable is the table that holds the message_contact relation/edge.
  67. MessageContactTable = "message_records"
  68. // MessageContactInverseTable is the table name for the Contact entity.
  69. // It exists in this package in order to avoid circular dependency with the "contact" package.
  70. MessageContactInverseTable = "contact"
  71. // MessageContactColumn is the table column denoting the message_contact relation/edge.
  72. MessageContactColumn = "contact_id"
  73. )
  74. // Columns holds all SQL columns for messagerecords fields.
  75. var Columns = []string{
  76. FieldID,
  77. FieldCreatedAt,
  78. FieldUpdatedAt,
  79. FieldStatus,
  80. FieldDeletedAt,
  81. FieldBotWxid,
  82. FieldContactID,
  83. FieldContactType,
  84. FieldContactWxid,
  85. FieldContentType,
  86. FieldContent,
  87. FieldErrorDetail,
  88. FieldSendTime,
  89. FieldSourceType,
  90. FieldSourceID,
  91. FieldSubSourceID,
  92. }
  93. // ValidColumn reports if the column name is valid (part of the table columns).
  94. func ValidColumn(column string) bool {
  95. for i := range Columns {
  96. if column == Columns[i] {
  97. return true
  98. }
  99. }
  100. return false
  101. }
  102. // Note that the variables below are initialized by the runtime
  103. // package on the initialization of the application. Therefore,
  104. // it should be imported in the main as follows:
  105. //
  106. // import _ "wechat-api/ent/runtime"
  107. var (
  108. Hooks [1]ent.Hook
  109. Interceptors [1]ent.Interceptor
  110. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  111. DefaultCreatedAt func() time.Time
  112. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  113. DefaultUpdatedAt func() time.Time
  114. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  115. UpdateDefaultUpdatedAt func() time.Time
  116. // DefaultStatus holds the default value on creation for the "status" field.
  117. DefaultStatus uint8
  118. // DefaultContactType holds the default value on creation for the "contact_type" field.
  119. DefaultContactType int
  120. // DefaultContactWxid holds the default value on creation for the "contact_wxid" field.
  121. DefaultContactWxid string
  122. // DefaultContentType holds the default value on creation for the "content_type" field.
  123. DefaultContentType int
  124. // DefaultContent holds the default value on creation for the "content" field.
  125. DefaultContent string
  126. // DefaultErrorDetail holds the default value on creation for the "error_detail" field.
  127. DefaultErrorDetail string
  128. // DefaultSourceType holds the default value on creation for the "source_type" field.
  129. DefaultSourceType int
  130. // DefaultSourceID holds the default value on creation for the "source_id" field.
  131. DefaultSourceID uint64
  132. // DefaultSubSourceID holds the default value on creation for the "sub_source_id" field.
  133. DefaultSubSourceID uint64
  134. )
  135. // OrderOption defines the ordering options for the MessageRecords queries.
  136. type OrderOption func(*sql.Selector)
  137. // ByID orders the results by the id field.
  138. func ByID(opts ...sql.OrderTermOption) OrderOption {
  139. return sql.OrderByField(FieldID, opts...).ToFunc()
  140. }
  141. // ByCreatedAt orders the results by the created_at field.
  142. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  143. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  144. }
  145. // ByUpdatedAt orders the results by the updated_at field.
  146. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  147. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  148. }
  149. // ByStatus orders the results by the status field.
  150. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  151. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  152. }
  153. // ByDeletedAt orders the results by the deleted_at field.
  154. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  155. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  156. }
  157. // ByBotWxid orders the results by the bot_wxid field.
  158. func ByBotWxid(opts ...sql.OrderTermOption) OrderOption {
  159. return sql.OrderByField(FieldBotWxid, opts...).ToFunc()
  160. }
  161. // ByContactID orders the results by the contact_id field.
  162. func ByContactID(opts ...sql.OrderTermOption) OrderOption {
  163. return sql.OrderByField(FieldContactID, opts...).ToFunc()
  164. }
  165. // ByContactType orders the results by the contact_type field.
  166. func ByContactType(opts ...sql.OrderTermOption) OrderOption {
  167. return sql.OrderByField(FieldContactType, opts...).ToFunc()
  168. }
  169. // ByContactWxid orders the results by the contact_wxid field.
  170. func ByContactWxid(opts ...sql.OrderTermOption) OrderOption {
  171. return sql.OrderByField(FieldContactWxid, opts...).ToFunc()
  172. }
  173. // ByContentType orders the results by the content_type field.
  174. func ByContentType(opts ...sql.OrderTermOption) OrderOption {
  175. return sql.OrderByField(FieldContentType, opts...).ToFunc()
  176. }
  177. // ByContent orders the results by the content field.
  178. func ByContent(opts ...sql.OrderTermOption) OrderOption {
  179. return sql.OrderByField(FieldContent, opts...).ToFunc()
  180. }
  181. // ByErrorDetail orders the results by the error_detail field.
  182. func ByErrorDetail(opts ...sql.OrderTermOption) OrderOption {
  183. return sql.OrderByField(FieldErrorDetail, opts...).ToFunc()
  184. }
  185. // BySendTime orders the results by the send_time field.
  186. func BySendTime(opts ...sql.OrderTermOption) OrderOption {
  187. return sql.OrderByField(FieldSendTime, opts...).ToFunc()
  188. }
  189. // BySourceType orders the results by the source_type field.
  190. func BySourceType(opts ...sql.OrderTermOption) OrderOption {
  191. return sql.OrderByField(FieldSourceType, opts...).ToFunc()
  192. }
  193. // BySourceID orders the results by the source_id field.
  194. func BySourceID(opts ...sql.OrderTermOption) OrderOption {
  195. return sql.OrderByField(FieldSourceID, opts...).ToFunc()
  196. }
  197. // BySubSourceID orders the results by the sub_source_id field.
  198. func BySubSourceID(opts ...sql.OrderTermOption) OrderOption {
  199. return sql.OrderByField(FieldSubSourceID, opts...).ToFunc()
  200. }
  201. // BySopStageField orders the results by sop_stage field.
  202. func BySopStageField(field string, opts ...sql.OrderTermOption) OrderOption {
  203. return func(s *sql.Selector) {
  204. sqlgraph.OrderByNeighborTerms(s, newSopStageStep(), sql.OrderByField(field, opts...))
  205. }
  206. }
  207. // BySopNodeField orders the results by sop_node field.
  208. func BySopNodeField(field string, opts ...sql.OrderTermOption) OrderOption {
  209. return func(s *sql.Selector) {
  210. sqlgraph.OrderByNeighborTerms(s, newSopNodeStep(), sql.OrderByField(field, opts...))
  211. }
  212. }
  213. // ByMessageContactField orders the results by message_contact field.
  214. func ByMessageContactField(field string, opts ...sql.OrderTermOption) OrderOption {
  215. return func(s *sql.Selector) {
  216. sqlgraph.OrderByNeighborTerms(s, newMessageContactStep(), sql.OrderByField(field, opts...))
  217. }
  218. }
  219. func newSopStageStep() *sqlgraph.Step {
  220. return sqlgraph.NewStep(
  221. sqlgraph.From(Table, FieldID),
  222. sqlgraph.To(SopStageInverseTable, FieldID),
  223. sqlgraph.Edge(sqlgraph.M2O, true, SopStageTable, SopStageColumn),
  224. )
  225. }
  226. func newSopNodeStep() *sqlgraph.Step {
  227. return sqlgraph.NewStep(
  228. sqlgraph.From(Table, FieldID),
  229. sqlgraph.To(SopNodeInverseTable, FieldID),
  230. sqlgraph.Edge(sqlgraph.M2O, true, SopNodeTable, SopNodeColumn),
  231. )
  232. }
  233. func newMessageContactStep() *sqlgraph.Step {
  234. return sqlgraph.NewStep(
  235. sqlgraph.From(Table, FieldID),
  236. sqlgraph.To(MessageContactInverseTable, FieldID),
  237. sqlgraph.Edge(sqlgraph.M2O, true, MessageContactTable, MessageContactColumn),
  238. )
  239. }