usagedetail.go 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. // Table holds the table name of the usagedetail in the database.
  43. Table = "usage_detail"
  44. )
  45. // Columns holds all SQL columns for usagedetail fields.
  46. var Columns = []string{
  47. FieldID,
  48. FieldCreatedAt,
  49. FieldUpdatedAt,
  50. FieldStatus,
  51. FieldType,
  52. FieldBotID,
  53. FieldReceiverID,
  54. FieldApp,
  55. FieldSessionID,
  56. FieldRequest,
  57. FieldResponse,
  58. FieldOriginalData,
  59. FieldTotalTokens,
  60. FieldPromptTokens,
  61. FieldCompletionTokens,
  62. FieldOrganizationID,
  63. }
  64. // ValidColumn reports if the column name is valid (part of the table columns).
  65. func ValidColumn(column string) bool {
  66. for i := range Columns {
  67. if column == Columns[i] {
  68. return true
  69. }
  70. }
  71. return false
  72. }
  73. var (
  74. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  75. DefaultCreatedAt func() time.Time
  76. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  77. DefaultUpdatedAt func() time.Time
  78. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  79. UpdateDefaultUpdatedAt func() time.Time
  80. // DefaultStatus holds the default value on creation for the "status" field.
  81. DefaultStatus uint8
  82. // DefaultType holds the default value on creation for the "type" field.
  83. DefaultType int
  84. // DefaultBotID holds the default value on creation for the "bot_id" field.
  85. DefaultBotID string
  86. // DefaultReceiverID holds the default value on creation for the "receiver_id" field.
  87. DefaultReceiverID string
  88. // DefaultApp holds the default value on creation for the "app" field.
  89. DefaultApp int
  90. // DefaultSessionID holds the default value on creation for the "session_id" field.
  91. DefaultSessionID uint64
  92. // DefaultRequest holds the default value on creation for the "request" field.
  93. DefaultRequest string
  94. // DefaultResponse holds the default value on creation for the "response" field.
  95. DefaultResponse string
  96. // DefaultTotalTokens holds the default value on creation for the "total_tokens" field.
  97. DefaultTotalTokens uint64
  98. // DefaultPromptTokens holds the default value on creation for the "prompt_tokens" field.
  99. DefaultPromptTokens uint64
  100. // DefaultCompletionTokens holds the default value on creation for the "completion_tokens" field.
  101. DefaultCompletionTokens uint64
  102. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  103. DefaultOrganizationID uint64
  104. )
  105. // OrderOption defines the ordering options for the UsageDetail queries.
  106. type OrderOption func(*sql.Selector)
  107. // ByID orders the results by the id field.
  108. func ByID(opts ...sql.OrderTermOption) OrderOption {
  109. return sql.OrderByField(FieldID, opts...).ToFunc()
  110. }
  111. // ByCreatedAt orders the results by the created_at field.
  112. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  113. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  114. }
  115. // ByUpdatedAt orders the results by the updated_at field.
  116. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  117. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  118. }
  119. // ByStatus orders the results by the status field.
  120. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  121. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  122. }
  123. // ByType orders the results by the type field.
  124. func ByType(opts ...sql.OrderTermOption) OrderOption {
  125. return sql.OrderByField(FieldType, opts...).ToFunc()
  126. }
  127. // ByBotID orders the results by the bot_id field.
  128. func ByBotID(opts ...sql.OrderTermOption) OrderOption {
  129. return sql.OrderByField(FieldBotID, opts...).ToFunc()
  130. }
  131. // ByReceiverID orders the results by the receiver_id field.
  132. func ByReceiverID(opts ...sql.OrderTermOption) OrderOption {
  133. return sql.OrderByField(FieldReceiverID, opts...).ToFunc()
  134. }
  135. // ByApp orders the results by the app field.
  136. func ByApp(opts ...sql.OrderTermOption) OrderOption {
  137. return sql.OrderByField(FieldApp, opts...).ToFunc()
  138. }
  139. // BySessionID orders the results by the session_id field.
  140. func BySessionID(opts ...sql.OrderTermOption) OrderOption {
  141. return sql.OrderByField(FieldSessionID, opts...).ToFunc()
  142. }
  143. // ByRequest orders the results by the request field.
  144. func ByRequest(opts ...sql.OrderTermOption) OrderOption {
  145. return sql.OrderByField(FieldRequest, opts...).ToFunc()
  146. }
  147. // ByResponse orders the results by the response field.
  148. func ByResponse(opts ...sql.OrderTermOption) OrderOption {
  149. return sql.OrderByField(FieldResponse, opts...).ToFunc()
  150. }
  151. // ByTotalTokens orders the results by the total_tokens field.
  152. func ByTotalTokens(opts ...sql.OrderTermOption) OrderOption {
  153. return sql.OrderByField(FieldTotalTokens, opts...).ToFunc()
  154. }
  155. // ByPromptTokens orders the results by the prompt_tokens field.
  156. func ByPromptTokens(opts ...sql.OrderTermOption) OrderOption {
  157. return sql.OrderByField(FieldPromptTokens, opts...).ToFunc()
  158. }
  159. // ByCompletionTokens orders the results by the completion_tokens field.
  160. func ByCompletionTokens(opts ...sql.OrderTermOption) OrderOption {
  161. return sql.OrderByField(FieldCompletionTokens, opts...).ToFunc()
  162. }
  163. // ByOrganizationID orders the results by the organization_id field.
  164. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  165. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  166. }