messagerecords.go 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. // Code generated by ent, DO NOT EDIT.
  2. package messagerecords
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. )
  7. const (
  8. // Label holds the string label denoting the messagerecords type in the database.
  9. Label = "message_records"
  10. // FieldID holds the string denoting the id field in the database.
  11. FieldID = "id"
  12. // FieldCreatedAt holds the string denoting the created_at field in the database.
  13. FieldCreatedAt = "created_at"
  14. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  15. FieldUpdatedAt = "updated_at"
  16. // FieldStatus holds the string denoting the status field in the database.
  17. FieldStatus = "status"
  18. // FieldBotWxid holds the string denoting the bot_wxid field in the database.
  19. FieldBotWxid = "bot_wxid"
  20. // FieldContactID holds the string denoting the contact_id field in the database.
  21. FieldContactID = "contact_id"
  22. // FieldContactType holds the string denoting the contact_type field in the database.
  23. FieldContactType = "contact_type"
  24. // FieldContactWxid holds the string denoting the contact_wxid field in the database.
  25. FieldContactWxid = "contact_wxid"
  26. // FieldContentType holds the string denoting the content_type field in the database.
  27. FieldContentType = "content_type"
  28. // FieldContent holds the string denoting the content field in the database.
  29. FieldContent = "content"
  30. // FieldMeta holds the string denoting the meta field in the database.
  31. FieldMeta = "meta"
  32. // FieldErrorDetail holds the string denoting the error_detail field in the database.
  33. FieldErrorDetail = "error_detail"
  34. // FieldSendTime holds the string denoting the send_time field in the database.
  35. FieldSendTime = "send_time"
  36. // FieldSourceType holds the string denoting the source_type field in the database.
  37. FieldSourceType = "source_type"
  38. // FieldSourceID holds the string denoting the source_id field in the database.
  39. FieldSourceID = "source_id"
  40. // FieldSubSourceID holds the string denoting the sub_source_id field in the database.
  41. FieldSubSourceID = "sub_source_id"
  42. // Table holds the table name of the messagerecords in the database.
  43. Table = "message_records"
  44. )
  45. // Columns holds all SQL columns for messagerecords fields.
  46. var Columns = []string{
  47. FieldID,
  48. FieldCreatedAt,
  49. FieldUpdatedAt,
  50. FieldStatus,
  51. FieldBotWxid,
  52. FieldContactID,
  53. FieldContactType,
  54. FieldContactWxid,
  55. FieldContentType,
  56. FieldContent,
  57. FieldMeta,
  58. FieldErrorDetail,
  59. FieldSendTime,
  60. FieldSourceType,
  61. FieldSourceID,
  62. FieldSubSourceID,
  63. }
  64. // ForeignKeys holds the SQL foreign-keys that are owned by the "message_records"
  65. // table and are not defined as standalone fields in the schema.
  66. var ForeignKeys = []string{
  67. "sop_node_node_messages",
  68. "sop_stage_stage_messages",
  69. }
  70. // ValidColumn reports if the column name is valid (part of the table columns).
  71. func ValidColumn(column string) bool {
  72. for i := range Columns {
  73. if column == Columns[i] {
  74. return true
  75. }
  76. }
  77. for i := range ForeignKeys {
  78. if column == ForeignKeys[i] {
  79. return true
  80. }
  81. }
  82. return false
  83. }
  84. var (
  85. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  86. DefaultCreatedAt func() time.Time
  87. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  88. DefaultUpdatedAt func() time.Time
  89. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  90. UpdateDefaultUpdatedAt func() time.Time
  91. // DefaultStatus holds the default value on creation for the "status" field.
  92. DefaultStatus uint8
  93. // DefaultContactType holds the default value on creation for the "contact_type" field.
  94. DefaultContactType int
  95. // DefaultContactWxid holds the default value on creation for the "contact_wxid" field.
  96. DefaultContactWxid string
  97. // DefaultContentType holds the default value on creation for the "content_type" field.
  98. DefaultContentType int
  99. // DefaultContent holds the default value on creation for the "content" field.
  100. DefaultContent string
  101. // DefaultErrorDetail holds the default value on creation for the "error_detail" field.
  102. DefaultErrorDetail string
  103. // DefaultSourceType holds the default value on creation for the "source_type" field.
  104. DefaultSourceType int
  105. // DefaultSourceID holds the default value on creation for the "source_id" field.
  106. DefaultSourceID uint64
  107. // DefaultSubSourceID holds the default value on creation for the "sub_source_id" field.
  108. DefaultSubSourceID uint64
  109. )
  110. // OrderOption defines the ordering options for the MessageRecords queries.
  111. type OrderOption func(*sql.Selector)
  112. // ByID orders the results by the id field.
  113. func ByID(opts ...sql.OrderTermOption) OrderOption {
  114. return sql.OrderByField(FieldID, opts...).ToFunc()
  115. }
  116. // ByCreatedAt orders the results by the created_at field.
  117. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  118. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  119. }
  120. // ByUpdatedAt orders the results by the updated_at field.
  121. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  122. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  123. }
  124. // ByStatus orders the results by the status field.
  125. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  126. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  127. }
  128. // ByBotWxid orders the results by the bot_wxid field.
  129. func ByBotWxid(opts ...sql.OrderTermOption) OrderOption {
  130. return sql.OrderByField(FieldBotWxid, opts...).ToFunc()
  131. }
  132. // ByContactID orders the results by the contact_id field.
  133. func ByContactID(opts ...sql.OrderTermOption) OrderOption {
  134. return sql.OrderByField(FieldContactID, opts...).ToFunc()
  135. }
  136. // ByContactType orders the results by the contact_type field.
  137. func ByContactType(opts ...sql.OrderTermOption) OrderOption {
  138. return sql.OrderByField(FieldContactType, opts...).ToFunc()
  139. }
  140. // ByContactWxid orders the results by the contact_wxid field.
  141. func ByContactWxid(opts ...sql.OrderTermOption) OrderOption {
  142. return sql.OrderByField(FieldContactWxid, opts...).ToFunc()
  143. }
  144. // ByContentType orders the results by the content_type field.
  145. func ByContentType(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldContentType, opts...).ToFunc()
  147. }
  148. // ByContent orders the results by the content field.
  149. func ByContent(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldContent, opts...).ToFunc()
  151. }
  152. // ByErrorDetail orders the results by the error_detail field.
  153. func ByErrorDetail(opts ...sql.OrderTermOption) OrderOption {
  154. return sql.OrderByField(FieldErrorDetail, opts...).ToFunc()
  155. }
  156. // BySendTime orders the results by the send_time field.
  157. func BySendTime(opts ...sql.OrderTermOption) OrderOption {
  158. return sql.OrderByField(FieldSendTime, opts...).ToFunc()
  159. }
  160. // BySourceType orders the results by the source_type field.
  161. func BySourceType(opts ...sql.OrderTermOption) OrderOption {
  162. return sql.OrderByField(FieldSourceType, opts...).ToFunc()
  163. }
  164. // BySourceID orders the results by the source_id field.
  165. func BySourceID(opts ...sql.OrderTermOption) OrderOption {
  166. return sql.OrderByField(FieldSourceID, opts...).ToFunc()
  167. }
  168. // BySubSourceID orders the results by the sub_source_id field.
  169. func BySubSourceID(opts ...sql.OrderTermOption) OrderOption {
  170. return sql.OrderByField(FieldSubSourceID, opts...).ToFunc()
  171. }