creditusage.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. // Code generated by ent, DO NOT EDIT.
  2. package creditusage
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. )
  8. const (
  9. // Label holds the string label denoting the creditusage type in the database.
  10. Label = "credit_usage"
  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. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  18. FieldDeletedAt = "deleted_at"
  19. // FieldUserID holds the string denoting the user_id field in the database.
  20. FieldUserID = "user_id"
  21. // FieldNumber holds the string denoting the number field in the database.
  22. FieldNumber = "number"
  23. // FieldStatus holds the string denoting the status field in the database.
  24. FieldStatus = "status"
  25. // FieldNtype holds the string denoting the ntype field in the database.
  26. FieldNtype = "ntype"
  27. // FieldTable holds the string denoting the table field in the database.
  28. FieldTable = "table"
  29. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  30. FieldOrganizationID = "organization_id"
  31. // FieldNid holds the string denoting the nid field in the database.
  32. FieldNid = "nid"
  33. // FieldReason holds the string denoting the reason field in the database.
  34. FieldReason = "reason"
  35. // FieldOperator holds the string denoting the operator field in the database.
  36. FieldOperator = "operator"
  37. // Table holds the table name of the creditusage in the database.
  38. Table = "credit_usage"
  39. )
  40. // Columns holds all SQL columns for creditusage fields.
  41. var Columns = []string{
  42. FieldID,
  43. FieldCreatedAt,
  44. FieldUpdatedAt,
  45. FieldDeletedAt,
  46. FieldUserID,
  47. FieldNumber,
  48. FieldStatus,
  49. FieldNtype,
  50. FieldTable,
  51. FieldOrganizationID,
  52. FieldNid,
  53. FieldReason,
  54. FieldOperator,
  55. }
  56. // ValidColumn reports if the column name is valid (part of the table columns).
  57. func ValidColumn(column string) bool {
  58. for i := range Columns {
  59. if column == Columns[i] {
  60. return true
  61. }
  62. }
  63. return false
  64. }
  65. // Note that the variables below are initialized by the runtime
  66. // package on the initialization of the application. Therefore,
  67. // it should be imported in the main as follows:
  68. //
  69. // import _ "wechat-api/ent/runtime"
  70. var (
  71. Hooks [1]ent.Hook
  72. Interceptors [1]ent.Interceptor
  73. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  74. DefaultCreatedAt func() time.Time
  75. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  76. DefaultUpdatedAt func() time.Time
  77. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  78. UpdateDefaultUpdatedAt func() time.Time
  79. // UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
  80. UserIDValidator func(string) error
  81. // DefaultStatus holds the default value on creation for the "status" field.
  82. DefaultStatus int
  83. // StatusValidator is a validator for the "status" field. It is called by the builders before save.
  84. StatusValidator func(int) error
  85. // DefaultNtype holds the default value on creation for the "ntype" field.
  86. DefaultNtype int
  87. // DefaultTable holds the default value on creation for the "table" field.
  88. DefaultTable string
  89. // DefaultNid holds the default value on creation for the "nid" field.
  90. DefaultNid uint64
  91. // DefaultReason holds the default value on creation for the "reason" field.
  92. DefaultReason string
  93. // ReasonValidator is a validator for the "reason" field. It is called by the builders before save.
  94. ReasonValidator func(string) error
  95. // DefaultOperator holds the default value on creation for the "operator" field.
  96. DefaultOperator string
  97. // OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
  98. OperatorValidator func(string) error
  99. )
  100. // OrderOption defines the ordering options for the CreditUsage queries.
  101. type OrderOption func(*sql.Selector)
  102. // ByID orders the results by the id field.
  103. func ByID(opts ...sql.OrderTermOption) OrderOption {
  104. return sql.OrderByField(FieldID, opts...).ToFunc()
  105. }
  106. // ByCreatedAt orders the results by the created_at field.
  107. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  108. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  109. }
  110. // ByUpdatedAt orders the results by the updated_at field.
  111. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  112. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  113. }
  114. // ByDeletedAt orders the results by the deleted_at field.
  115. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  116. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  117. }
  118. // ByUserID orders the results by the user_id field.
  119. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  120. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  121. }
  122. // ByNumber orders the results by the number field.
  123. func ByNumber(opts ...sql.OrderTermOption) OrderOption {
  124. return sql.OrderByField(FieldNumber, opts...).ToFunc()
  125. }
  126. // ByStatus orders the results by the status field.
  127. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  128. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  129. }
  130. // ByNtype orders the results by the ntype field.
  131. func ByNtype(opts ...sql.OrderTermOption) OrderOption {
  132. return sql.OrderByField(FieldNtype, opts...).ToFunc()
  133. }
  134. // ByTable orders the results by the table field.
  135. func ByTable(opts ...sql.OrderTermOption) OrderOption {
  136. return sql.OrderByField(FieldTable, opts...).ToFunc()
  137. }
  138. // ByOrganizationID orders the results by the organization_id field.
  139. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  140. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  141. }
  142. // ByNid orders the results by the nid field.
  143. func ByNid(opts ...sql.OrderTermOption) OrderOption {
  144. return sql.OrderByField(FieldNid, opts...).ToFunc()
  145. }
  146. // ByReason orders the results by the reason field.
  147. func ByReason(opts ...sql.OrderTermOption) OrderOption {
  148. return sql.OrderByField(FieldReason, opts...).ToFunc()
  149. }
  150. // ByOperator orders the results by the operator field.
  151. func ByOperator(opts ...sql.OrderTermOption) OrderOption {
  152. return sql.OrderByField(FieldOperator, opts...).ToFunc()
  153. }