usagedetail.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. // Code generated by ent, DO NOT EDIT.
  2. package usagedetail
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. )
  7. const (
  8. // Label holds the string label denoting the usagedetail type in the database.
  9. Label = "usage_detail"
  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. // FieldType holds the string denoting the type field in the database.
  19. FieldType = "type"
  20. // FieldBotID holds the string denoting the bot_id field in the database.
  21. FieldBotID = "bot_id"
  22. // FieldReceiverID holds the string denoting the receiver_id field in the database.
  23. FieldReceiverID = "receiver_id"
  24. // FieldApp holds the string denoting the app field in the database.
  25. FieldApp = "app"
  26. // FieldSessionID holds the string denoting the session_id field in the database.
  27. FieldSessionID = "session_id"
  28. // FieldRequest holds the string denoting the request field in the database.
  29. FieldRequest = "request"
  30. // FieldResponse holds the string denoting the response field in the database.
  31. FieldResponse = "response"
  32. // FieldOriginalData holds the string denoting the original_data field in the database.
  33. FieldOriginalData = "original_data"
  34. // FieldTotalTokens holds the string denoting the total_tokens field in the database.
  35. FieldTotalTokens = "total_tokens"
  36. // FieldPromptTokens holds the string denoting the prompt_tokens field in the database.
  37. FieldPromptTokens = "prompt_tokens"
  38. // FieldCompletionTokens holds the string denoting the completion_tokens field in the database.
  39. FieldCompletionTokens = "completion_tokens"
  40. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  41. FieldOrganizationID = "organization_id"
  42. // FieldModel holds the string denoting the model field in the database.
  43. FieldModel = "model"
  44. // FieldCredits holds the string denoting the credits field in the database.
  45. FieldCredits = "credits"
  46. // Table holds the table name of the usagedetail in the database.
  47. Table = "usage_detail"
  48. )
  49. // Columns holds all SQL columns for usagedetail fields.
  50. var Columns = []string{
  51. FieldID,
  52. FieldCreatedAt,
  53. FieldUpdatedAt,
  54. FieldStatus,
  55. FieldType,
  56. FieldBotID,
  57. FieldReceiverID,
  58. FieldApp,
  59. FieldSessionID,
  60. FieldRequest,
  61. FieldResponse,
  62. FieldOriginalData,
  63. FieldTotalTokens,
  64. FieldPromptTokens,
  65. FieldCompletionTokens,
  66. FieldOrganizationID,
  67. FieldModel,
  68. FieldCredits,
  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. return false
  78. }
  79. var (
  80. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  81. DefaultCreatedAt func() time.Time
  82. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  83. DefaultUpdatedAt func() time.Time
  84. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  85. UpdateDefaultUpdatedAt func() time.Time
  86. // DefaultStatus holds the default value on creation for the "status" field.
  87. DefaultStatus uint8
  88. // DefaultType holds the default value on creation for the "type" field.
  89. DefaultType int
  90. // DefaultBotID holds the default value on creation for the "bot_id" field.
  91. DefaultBotID string
  92. // DefaultReceiverID holds the default value on creation for the "receiver_id" field.
  93. DefaultReceiverID string
  94. // DefaultApp holds the default value on creation for the "app" field.
  95. DefaultApp int
  96. // DefaultSessionID holds the default value on creation for the "session_id" field.
  97. DefaultSessionID uint64
  98. // DefaultRequest holds the default value on creation for the "request" field.
  99. DefaultRequest string
  100. // DefaultResponse holds the default value on creation for the "response" field.
  101. DefaultResponse string
  102. // DefaultTotalTokens holds the default value on creation for the "total_tokens" field.
  103. DefaultTotalTokens uint64
  104. // DefaultPromptTokens holds the default value on creation for the "prompt_tokens" field.
  105. DefaultPromptTokens uint64
  106. // DefaultCompletionTokens holds the default value on creation for the "completion_tokens" field.
  107. DefaultCompletionTokens uint64
  108. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  109. DefaultOrganizationID uint64
  110. // DefaultModel holds the default value on creation for the "model" field.
  111. DefaultModel string
  112. )
  113. // OrderOption defines the ordering options for the UsageDetail queries.
  114. type OrderOption func(*sql.Selector)
  115. // ByID orders the results by the id field.
  116. func ByID(opts ...sql.OrderTermOption) OrderOption {
  117. return sql.OrderByField(FieldID, opts...).ToFunc()
  118. }
  119. // ByCreatedAt orders the results by the created_at field.
  120. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  121. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  122. }
  123. // ByUpdatedAt orders the results by the updated_at field.
  124. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  125. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  126. }
  127. // ByStatus orders the results by the status field.
  128. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  129. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  130. }
  131. // ByType orders the results by the type field.
  132. func ByType(opts ...sql.OrderTermOption) OrderOption {
  133. return sql.OrderByField(FieldType, opts...).ToFunc()
  134. }
  135. // ByBotID orders the results by the bot_id field.
  136. func ByBotID(opts ...sql.OrderTermOption) OrderOption {
  137. return sql.OrderByField(FieldBotID, opts...).ToFunc()
  138. }
  139. // ByReceiverID orders the results by the receiver_id field.
  140. func ByReceiverID(opts ...sql.OrderTermOption) OrderOption {
  141. return sql.OrderByField(FieldReceiverID, opts...).ToFunc()
  142. }
  143. // ByApp orders the results by the app field.
  144. func ByApp(opts ...sql.OrderTermOption) OrderOption {
  145. return sql.OrderByField(FieldApp, opts...).ToFunc()
  146. }
  147. // BySessionID orders the results by the session_id field.
  148. func BySessionID(opts ...sql.OrderTermOption) OrderOption {
  149. return sql.OrderByField(FieldSessionID, opts...).ToFunc()
  150. }
  151. // ByRequest orders the results by the request field.
  152. func ByRequest(opts ...sql.OrderTermOption) OrderOption {
  153. return sql.OrderByField(FieldRequest, opts...).ToFunc()
  154. }
  155. // ByResponse orders the results by the response field.
  156. func ByResponse(opts ...sql.OrderTermOption) OrderOption {
  157. return sql.OrderByField(FieldResponse, opts...).ToFunc()
  158. }
  159. // ByTotalTokens orders the results by the total_tokens field.
  160. func ByTotalTokens(opts ...sql.OrderTermOption) OrderOption {
  161. return sql.OrderByField(FieldTotalTokens, opts...).ToFunc()
  162. }
  163. // ByPromptTokens orders the results by the prompt_tokens field.
  164. func ByPromptTokens(opts ...sql.OrderTermOption) OrderOption {
  165. return sql.OrderByField(FieldPromptTokens, opts...).ToFunc()
  166. }
  167. // ByCompletionTokens orders the results by the completion_tokens field.
  168. func ByCompletionTokens(opts ...sql.OrderTermOption) OrderOption {
  169. return sql.OrderByField(FieldCompletionTokens, opts...).ToFunc()
  170. }
  171. // ByOrganizationID orders the results by the organization_id field.
  172. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  173. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  174. }
  175. // ByModel orders the results by the model field.
  176. func ByModel(opts ...sql.OrderTermOption) OrderOption {
  177. return sql.OrderByField(FieldModel, opts...).ToFunc()
  178. }
  179. // ByCredits orders the results by the credits field.
  180. func ByCredits(opts ...sql.OrderTermOption) OrderOption {
  181. return sql.OrderByField(FieldCredits, opts...).ToFunc()
  182. }