usagedetail.go 6.8 KB

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