messagerecords.go 10 KB

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