messagerecords.go 11 KB

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