usagelog.go 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. // Code generated by ent, DO NOT EDIT.
  2. package usagelog
  3. import (
  4. "time"
  5. "entgo.io/ent/dialect/sql"
  6. "entgo.io/ent/dialect/sql/sqlgraph"
  7. )
  8. const (
  9. // Label holds the string label denoting the usagelog type in the database.
  10. Label = "usage_log"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldUserID holds the string denoting the user_id field in the database.
  14. FieldUserID = "user_id"
  15. // FieldAPIKeyID holds the string denoting the api_key_id field in the database.
  16. FieldAPIKeyID = "api_key_id"
  17. // FieldAccountID holds the string denoting the account_id field in the database.
  18. FieldAccountID = "account_id"
  19. // FieldRequestID holds the string denoting the request_id field in the database.
  20. FieldRequestID = "request_id"
  21. // FieldModel holds the string denoting the model field in the database.
  22. FieldModel = "model"
  23. // FieldRequestedModel holds the string denoting the requested_model field in the database.
  24. FieldRequestedModel = "requested_model"
  25. // FieldUpstreamModel holds the string denoting the upstream_model field in the database.
  26. FieldUpstreamModel = "upstream_model"
  27. // FieldUpstreamResponseModel holds the string denoting the upstream_response_model field in the database.
  28. FieldUpstreamResponseModel = "upstream_response_model"
  29. // FieldUpstreamModelMismatch holds the string denoting the upstream_model_mismatch field in the database.
  30. FieldUpstreamModelMismatch = "upstream_model_mismatch"
  31. // FieldChannelID holds the string denoting the channel_id field in the database.
  32. FieldChannelID = "channel_id"
  33. // FieldModelMappingChain holds the string denoting the model_mapping_chain field in the database.
  34. FieldModelMappingChain = "model_mapping_chain"
  35. // FieldBillingTier holds the string denoting the billing_tier field in the database.
  36. FieldBillingTier = "billing_tier"
  37. // FieldBillingMode holds the string denoting the billing_mode field in the database.
  38. FieldBillingMode = "billing_mode"
  39. // FieldGroupID holds the string denoting the group_id field in the database.
  40. FieldGroupID = "group_id"
  41. // FieldSubscriptionID holds the string denoting the subscription_id field in the database.
  42. FieldSubscriptionID = "subscription_id"
  43. // FieldInputTokens holds the string denoting the input_tokens field in the database.
  44. FieldInputTokens = "input_tokens"
  45. // FieldOutputTokens holds the string denoting the output_tokens field in the database.
  46. FieldOutputTokens = "output_tokens"
  47. // FieldCacheCreationTokens holds the string denoting the cache_creation_tokens field in the database.
  48. FieldCacheCreationTokens = "cache_creation_tokens"
  49. // FieldCacheReadTokens holds the string denoting the cache_read_tokens field in the database.
  50. FieldCacheReadTokens = "cache_read_tokens"
  51. // FieldCacheCreation5mTokens holds the string denoting the cache_creation_5m_tokens field in the database.
  52. FieldCacheCreation5mTokens = "cache_creation_5m_tokens"
  53. // FieldCacheCreation1hTokens holds the string denoting the cache_creation_1h_tokens field in the database.
  54. FieldCacheCreation1hTokens = "cache_creation_1h_tokens"
  55. // FieldInputCost holds the string denoting the input_cost field in the database.
  56. FieldInputCost = "input_cost"
  57. // FieldOutputCost holds the string denoting the output_cost field in the database.
  58. FieldOutputCost = "output_cost"
  59. // FieldCacheCreationCost holds the string denoting the cache_creation_cost field in the database.
  60. FieldCacheCreationCost = "cache_creation_cost"
  61. // FieldCacheReadCost holds the string denoting the cache_read_cost field in the database.
  62. FieldCacheReadCost = "cache_read_cost"
  63. // FieldTotalCost holds the string denoting the total_cost field in the database.
  64. FieldTotalCost = "total_cost"
  65. // FieldActualCost holds the string denoting the actual_cost field in the database.
  66. FieldActualCost = "actual_cost"
  67. // FieldRateMultiplier holds the string denoting the rate_multiplier field in the database.
  68. FieldRateMultiplier = "rate_multiplier"
  69. // FieldLongContextBillingApplied holds the string denoting the long_context_billing_applied field in the database.
  70. FieldLongContextBillingApplied = "long_context_billing_applied"
  71. // FieldAccountRateMultiplier holds the string denoting the account_rate_multiplier field in the database.
  72. FieldAccountRateMultiplier = "account_rate_multiplier"
  73. // FieldBillingType holds the string denoting the billing_type field in the database.
  74. FieldBillingType = "billing_type"
  75. // FieldStream holds the string denoting the stream field in the database.
  76. FieldStream = "stream"
  77. // FieldDurationMs holds the string denoting the duration_ms field in the database.
  78. FieldDurationMs = "duration_ms"
  79. // FieldFirstTokenMs holds the string denoting the first_token_ms field in the database.
  80. FieldFirstTokenMs = "first_token_ms"
  81. // FieldUserAgent holds the string denoting the user_agent field in the database.
  82. FieldUserAgent = "user_agent"
  83. // FieldIPAddress holds the string denoting the ip_address field in the database.
  84. FieldIPAddress = "ip_address"
  85. // FieldImageCount holds the string denoting the image_count field in the database.
  86. FieldImageCount = "image_count"
  87. // FieldImageSize holds the string denoting the image_size field in the database.
  88. FieldImageSize = "image_size"
  89. // FieldImageInputSize holds the string denoting the image_input_size field in the database.
  90. FieldImageInputSize = "image_input_size"
  91. // FieldImageOutputSize holds the string denoting the image_output_size field in the database.
  92. FieldImageOutputSize = "image_output_size"
  93. // FieldImageSizeSource holds the string denoting the image_size_source field in the database.
  94. FieldImageSizeSource = "image_size_source"
  95. // FieldImageSizeBreakdown holds the string denoting the image_size_breakdown field in the database.
  96. FieldImageSizeBreakdown = "image_size_breakdown"
  97. // FieldVideoCount holds the string denoting the video_count field in the database.
  98. FieldVideoCount = "video_count"
  99. // FieldVideoResolution holds the string denoting the video_resolution field in the database.
  100. FieldVideoResolution = "video_resolution"
  101. // FieldVideoDurationSeconds holds the string denoting the video_duration_seconds field in the database.
  102. FieldVideoDurationSeconds = "video_duration_seconds"
  103. // FieldCacheTTLOverridden holds the string denoting the cache_ttl_overridden field in the database.
  104. FieldCacheTTLOverridden = "cache_ttl_overridden"
  105. // FieldCreatedAt holds the string denoting the created_at field in the database.
  106. FieldCreatedAt = "created_at"
  107. // EdgeUser holds the string denoting the user edge name in mutations.
  108. EdgeUser = "user"
  109. // EdgeAPIKey holds the string denoting the api_key edge name in mutations.
  110. EdgeAPIKey = "api_key"
  111. // EdgeAccount holds the string denoting the account edge name in mutations.
  112. EdgeAccount = "account"
  113. // EdgeGroup holds the string denoting the group edge name in mutations.
  114. EdgeGroup = "group"
  115. // EdgeSubscription holds the string denoting the subscription edge name in mutations.
  116. EdgeSubscription = "subscription"
  117. // Table holds the table name of the usagelog in the database.
  118. Table = "usage_logs"
  119. // UserTable is the table that holds the user relation/edge.
  120. UserTable = "usage_logs"
  121. // UserInverseTable is the table name for the User entity.
  122. // It exists in this package in order to avoid circular dependency with the "user" package.
  123. UserInverseTable = "users"
  124. // UserColumn is the table column denoting the user relation/edge.
  125. UserColumn = "user_id"
  126. // APIKeyTable is the table that holds the api_key relation/edge.
  127. APIKeyTable = "usage_logs"
  128. // APIKeyInverseTable is the table name for the APIKey entity.
  129. // It exists in this package in order to avoid circular dependency with the "apikey" package.
  130. APIKeyInverseTable = "api_keys"
  131. // APIKeyColumn is the table column denoting the api_key relation/edge.
  132. APIKeyColumn = "api_key_id"
  133. // AccountTable is the table that holds the account relation/edge.
  134. AccountTable = "usage_logs"
  135. // AccountInverseTable is the table name for the Account entity.
  136. // It exists in this package in order to avoid circular dependency with the "account" package.
  137. AccountInverseTable = "accounts"
  138. // AccountColumn is the table column denoting the account relation/edge.
  139. AccountColumn = "account_id"
  140. // GroupTable is the table that holds the group relation/edge.
  141. GroupTable = "usage_logs"
  142. // GroupInverseTable is the table name for the Group entity.
  143. // It exists in this package in order to avoid circular dependency with the "group" package.
  144. GroupInverseTable = "groups"
  145. // GroupColumn is the table column denoting the group relation/edge.
  146. GroupColumn = "group_id"
  147. // SubscriptionTable is the table that holds the subscription relation/edge.
  148. SubscriptionTable = "usage_logs"
  149. // SubscriptionInverseTable is the table name for the UserSubscription entity.
  150. // It exists in this package in order to avoid circular dependency with the "usersubscription" package.
  151. SubscriptionInverseTable = "user_subscriptions"
  152. // SubscriptionColumn is the table column denoting the subscription relation/edge.
  153. SubscriptionColumn = "subscription_id"
  154. )
  155. // Columns holds all SQL columns for usagelog fields.
  156. var Columns = []string{
  157. FieldID,
  158. FieldUserID,
  159. FieldAPIKeyID,
  160. FieldAccountID,
  161. FieldRequestID,
  162. FieldModel,
  163. FieldRequestedModel,
  164. FieldUpstreamModel,
  165. FieldUpstreamResponseModel,
  166. FieldUpstreamModelMismatch,
  167. FieldChannelID,
  168. FieldModelMappingChain,
  169. FieldBillingTier,
  170. FieldBillingMode,
  171. FieldGroupID,
  172. FieldSubscriptionID,
  173. FieldInputTokens,
  174. FieldOutputTokens,
  175. FieldCacheCreationTokens,
  176. FieldCacheReadTokens,
  177. FieldCacheCreation5mTokens,
  178. FieldCacheCreation1hTokens,
  179. FieldInputCost,
  180. FieldOutputCost,
  181. FieldCacheCreationCost,
  182. FieldCacheReadCost,
  183. FieldTotalCost,
  184. FieldActualCost,
  185. FieldRateMultiplier,
  186. FieldLongContextBillingApplied,
  187. FieldAccountRateMultiplier,
  188. FieldBillingType,
  189. FieldStream,
  190. FieldDurationMs,
  191. FieldFirstTokenMs,
  192. FieldUserAgent,
  193. FieldIPAddress,
  194. FieldImageCount,
  195. FieldImageSize,
  196. FieldImageInputSize,
  197. FieldImageOutputSize,
  198. FieldImageSizeSource,
  199. FieldImageSizeBreakdown,
  200. FieldVideoCount,
  201. FieldVideoResolution,
  202. FieldVideoDurationSeconds,
  203. FieldCacheTTLOverridden,
  204. FieldCreatedAt,
  205. }
  206. // ValidColumn reports if the column name is valid (part of the table columns).
  207. func ValidColumn(column string) bool {
  208. for i := range Columns {
  209. if column == Columns[i] {
  210. return true
  211. }
  212. }
  213. return false
  214. }
  215. var (
  216. // RequestIDValidator is a validator for the "request_id" field. It is called by the builders before save.
  217. RequestIDValidator func(string) error
  218. // ModelValidator is a validator for the "model" field. It is called by the builders before save.
  219. ModelValidator func(string) error
  220. // RequestedModelValidator is a validator for the "requested_model" field. It is called by the builders before save.
  221. RequestedModelValidator func(string) error
  222. // UpstreamModelValidator is a validator for the "upstream_model" field. It is called by the builders before save.
  223. UpstreamModelValidator func(string) error
  224. // UpstreamResponseModelValidator is a validator for the "upstream_response_model" field. It is called by the builders before save.
  225. UpstreamResponseModelValidator func(string) error
  226. // ModelMappingChainValidator is a validator for the "model_mapping_chain" field. It is called by the builders before save.
  227. ModelMappingChainValidator func(string) error
  228. // BillingTierValidator is a validator for the "billing_tier" field. It is called by the builders before save.
  229. BillingTierValidator func(string) error
  230. // BillingModeValidator is a validator for the "billing_mode" field. It is called by the builders before save.
  231. BillingModeValidator func(string) error
  232. // DefaultInputTokens holds the default value on creation for the "input_tokens" field.
  233. DefaultInputTokens int
  234. // DefaultOutputTokens holds the default value on creation for the "output_tokens" field.
  235. DefaultOutputTokens int
  236. // DefaultCacheCreationTokens holds the default value on creation for the "cache_creation_tokens" field.
  237. DefaultCacheCreationTokens int
  238. // DefaultCacheReadTokens holds the default value on creation for the "cache_read_tokens" field.
  239. DefaultCacheReadTokens int
  240. // DefaultCacheCreation5mTokens holds the default value on creation for the "cache_creation_5m_tokens" field.
  241. DefaultCacheCreation5mTokens int
  242. // DefaultCacheCreation1hTokens holds the default value on creation for the "cache_creation_1h_tokens" field.
  243. DefaultCacheCreation1hTokens int
  244. // DefaultInputCost holds the default value on creation for the "input_cost" field.
  245. DefaultInputCost float64
  246. // DefaultOutputCost holds the default value on creation for the "output_cost" field.
  247. DefaultOutputCost float64
  248. // DefaultCacheCreationCost holds the default value on creation for the "cache_creation_cost" field.
  249. DefaultCacheCreationCost float64
  250. // DefaultCacheReadCost holds the default value on creation for the "cache_read_cost" field.
  251. DefaultCacheReadCost float64
  252. // DefaultTotalCost holds the default value on creation for the "total_cost" field.
  253. DefaultTotalCost float64
  254. // DefaultActualCost holds the default value on creation for the "actual_cost" field.
  255. DefaultActualCost float64
  256. // DefaultRateMultiplier holds the default value on creation for the "rate_multiplier" field.
  257. DefaultRateMultiplier float64
  258. // DefaultLongContextBillingApplied holds the default value on creation for the "long_context_billing_applied" field.
  259. DefaultLongContextBillingApplied bool
  260. // DefaultBillingType holds the default value on creation for the "billing_type" field.
  261. DefaultBillingType int8
  262. // DefaultStream holds the default value on creation for the "stream" field.
  263. DefaultStream bool
  264. // UserAgentValidator is a validator for the "user_agent" field. It is called by the builders before save.
  265. UserAgentValidator func(string) error
  266. // IPAddressValidator is a validator for the "ip_address" field. It is called by the builders before save.
  267. IPAddressValidator func(string) error
  268. // DefaultImageCount holds the default value on creation for the "image_count" field.
  269. DefaultImageCount int
  270. // ImageSizeValidator is a validator for the "image_size" field. It is called by the builders before save.
  271. ImageSizeValidator func(string) error
  272. // ImageInputSizeValidator is a validator for the "image_input_size" field. It is called by the builders before save.
  273. ImageInputSizeValidator func(string) error
  274. // ImageOutputSizeValidator is a validator for the "image_output_size" field. It is called by the builders before save.
  275. ImageOutputSizeValidator func(string) error
  276. // ImageSizeSourceValidator is a validator for the "image_size_source" field. It is called by the builders before save.
  277. ImageSizeSourceValidator func(string) error
  278. // DefaultVideoCount holds the default value on creation for the "video_count" field.
  279. DefaultVideoCount int
  280. // VideoResolutionValidator is a validator for the "video_resolution" field. It is called by the builders before save.
  281. VideoResolutionValidator func(string) error
  282. // DefaultCacheTTLOverridden holds the default value on creation for the "cache_ttl_overridden" field.
  283. DefaultCacheTTLOverridden bool
  284. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  285. DefaultCreatedAt func() time.Time
  286. )
  287. // OrderOption defines the ordering options for the UsageLog queries.
  288. type OrderOption func(*sql.Selector)
  289. // ByID orders the results by the id field.
  290. func ByID(opts ...sql.OrderTermOption) OrderOption {
  291. return sql.OrderByField(FieldID, opts...).ToFunc()
  292. }
  293. // ByUserID orders the results by the user_id field.
  294. func ByUserID(opts ...sql.OrderTermOption) OrderOption {
  295. return sql.OrderByField(FieldUserID, opts...).ToFunc()
  296. }
  297. // ByAPIKeyID orders the results by the api_key_id field.
  298. func ByAPIKeyID(opts ...sql.OrderTermOption) OrderOption {
  299. return sql.OrderByField(FieldAPIKeyID, opts...).ToFunc()
  300. }
  301. // ByAccountID orders the results by the account_id field.
  302. func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
  303. return sql.OrderByField(FieldAccountID, opts...).ToFunc()
  304. }
  305. // ByRequestID orders the results by the request_id field.
  306. func ByRequestID(opts ...sql.OrderTermOption) OrderOption {
  307. return sql.OrderByField(FieldRequestID, opts...).ToFunc()
  308. }
  309. // ByModel orders the results by the model field.
  310. func ByModel(opts ...sql.OrderTermOption) OrderOption {
  311. return sql.OrderByField(FieldModel, opts...).ToFunc()
  312. }
  313. // ByRequestedModel orders the results by the requested_model field.
  314. func ByRequestedModel(opts ...sql.OrderTermOption) OrderOption {
  315. return sql.OrderByField(FieldRequestedModel, opts...).ToFunc()
  316. }
  317. // ByUpstreamModel orders the results by the upstream_model field.
  318. func ByUpstreamModel(opts ...sql.OrderTermOption) OrderOption {
  319. return sql.OrderByField(FieldUpstreamModel, opts...).ToFunc()
  320. }
  321. // ByUpstreamResponseModel orders the results by the upstream_response_model field.
  322. func ByUpstreamResponseModel(opts ...sql.OrderTermOption) OrderOption {
  323. return sql.OrderByField(FieldUpstreamResponseModel, opts...).ToFunc()
  324. }
  325. // ByUpstreamModelMismatch orders the results by the upstream_model_mismatch field.
  326. func ByUpstreamModelMismatch(opts ...sql.OrderTermOption) OrderOption {
  327. return sql.OrderByField(FieldUpstreamModelMismatch, opts...).ToFunc()
  328. }
  329. // ByChannelID orders the results by the channel_id field.
  330. func ByChannelID(opts ...sql.OrderTermOption) OrderOption {
  331. return sql.OrderByField(FieldChannelID, opts...).ToFunc()
  332. }
  333. // ByModelMappingChain orders the results by the model_mapping_chain field.
  334. func ByModelMappingChain(opts ...sql.OrderTermOption) OrderOption {
  335. return sql.OrderByField(FieldModelMappingChain, opts...).ToFunc()
  336. }
  337. // ByBillingTier orders the results by the billing_tier field.
  338. func ByBillingTier(opts ...sql.OrderTermOption) OrderOption {
  339. return sql.OrderByField(FieldBillingTier, opts...).ToFunc()
  340. }
  341. // ByBillingMode orders the results by the billing_mode field.
  342. func ByBillingMode(opts ...sql.OrderTermOption) OrderOption {
  343. return sql.OrderByField(FieldBillingMode, opts...).ToFunc()
  344. }
  345. // ByGroupID orders the results by the group_id field.
  346. func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
  347. return sql.OrderByField(FieldGroupID, opts...).ToFunc()
  348. }
  349. // BySubscriptionID orders the results by the subscription_id field.
  350. func BySubscriptionID(opts ...sql.OrderTermOption) OrderOption {
  351. return sql.OrderByField(FieldSubscriptionID, opts...).ToFunc()
  352. }
  353. // ByInputTokens orders the results by the input_tokens field.
  354. func ByInputTokens(opts ...sql.OrderTermOption) OrderOption {
  355. return sql.OrderByField(FieldInputTokens, opts...).ToFunc()
  356. }
  357. // ByOutputTokens orders the results by the output_tokens field.
  358. func ByOutputTokens(opts ...sql.OrderTermOption) OrderOption {
  359. return sql.OrderByField(FieldOutputTokens, opts...).ToFunc()
  360. }
  361. // ByCacheCreationTokens orders the results by the cache_creation_tokens field.
  362. func ByCacheCreationTokens(opts ...sql.OrderTermOption) OrderOption {
  363. return sql.OrderByField(FieldCacheCreationTokens, opts...).ToFunc()
  364. }
  365. // ByCacheReadTokens orders the results by the cache_read_tokens field.
  366. func ByCacheReadTokens(opts ...sql.OrderTermOption) OrderOption {
  367. return sql.OrderByField(FieldCacheReadTokens, opts...).ToFunc()
  368. }
  369. // ByCacheCreation5mTokens orders the results by the cache_creation_5m_tokens field.
  370. func ByCacheCreation5mTokens(opts ...sql.OrderTermOption) OrderOption {
  371. return sql.OrderByField(FieldCacheCreation5mTokens, opts...).ToFunc()
  372. }
  373. // ByCacheCreation1hTokens orders the results by the cache_creation_1h_tokens field.
  374. func ByCacheCreation1hTokens(opts ...sql.OrderTermOption) OrderOption {
  375. return sql.OrderByField(FieldCacheCreation1hTokens, opts...).ToFunc()
  376. }
  377. // ByInputCost orders the results by the input_cost field.
  378. func ByInputCost(opts ...sql.OrderTermOption) OrderOption {
  379. return sql.OrderByField(FieldInputCost, opts...).ToFunc()
  380. }
  381. // ByOutputCost orders the results by the output_cost field.
  382. func ByOutputCost(opts ...sql.OrderTermOption) OrderOption {
  383. return sql.OrderByField(FieldOutputCost, opts...).ToFunc()
  384. }
  385. // ByCacheCreationCost orders the results by the cache_creation_cost field.
  386. func ByCacheCreationCost(opts ...sql.OrderTermOption) OrderOption {
  387. return sql.OrderByField(FieldCacheCreationCost, opts...).ToFunc()
  388. }
  389. // ByCacheReadCost orders the results by the cache_read_cost field.
  390. func ByCacheReadCost(opts ...sql.OrderTermOption) OrderOption {
  391. return sql.OrderByField(FieldCacheReadCost, opts...).ToFunc()
  392. }
  393. // ByTotalCost orders the results by the total_cost field.
  394. func ByTotalCost(opts ...sql.OrderTermOption) OrderOption {
  395. return sql.OrderByField(FieldTotalCost, opts...).ToFunc()
  396. }
  397. // ByActualCost orders the results by the actual_cost field.
  398. func ByActualCost(opts ...sql.OrderTermOption) OrderOption {
  399. return sql.OrderByField(FieldActualCost, opts...).ToFunc()
  400. }
  401. // ByRateMultiplier orders the results by the rate_multiplier field.
  402. func ByRateMultiplier(opts ...sql.OrderTermOption) OrderOption {
  403. return sql.OrderByField(FieldRateMultiplier, opts...).ToFunc()
  404. }
  405. // ByLongContextBillingApplied orders the results by the long_context_billing_applied field.
  406. func ByLongContextBillingApplied(opts ...sql.OrderTermOption) OrderOption {
  407. return sql.OrderByField(FieldLongContextBillingApplied, opts...).ToFunc()
  408. }
  409. // ByAccountRateMultiplier orders the results by the account_rate_multiplier field.
  410. func ByAccountRateMultiplier(opts ...sql.OrderTermOption) OrderOption {
  411. return sql.OrderByField(FieldAccountRateMultiplier, opts...).ToFunc()
  412. }
  413. // ByBillingType orders the results by the billing_type field.
  414. func ByBillingType(opts ...sql.OrderTermOption) OrderOption {
  415. return sql.OrderByField(FieldBillingType, opts...).ToFunc()
  416. }
  417. // ByStream orders the results by the stream field.
  418. func ByStream(opts ...sql.OrderTermOption) OrderOption {
  419. return sql.OrderByField(FieldStream, opts...).ToFunc()
  420. }
  421. // ByDurationMs orders the results by the duration_ms field.
  422. func ByDurationMs(opts ...sql.OrderTermOption) OrderOption {
  423. return sql.OrderByField(FieldDurationMs, opts...).ToFunc()
  424. }
  425. // ByFirstTokenMs orders the results by the first_token_ms field.
  426. func ByFirstTokenMs(opts ...sql.OrderTermOption) OrderOption {
  427. return sql.OrderByField(FieldFirstTokenMs, opts...).ToFunc()
  428. }
  429. // ByUserAgent orders the results by the user_agent field.
  430. func ByUserAgent(opts ...sql.OrderTermOption) OrderOption {
  431. return sql.OrderByField(FieldUserAgent, opts...).ToFunc()
  432. }
  433. // ByIPAddress orders the results by the ip_address field.
  434. func ByIPAddress(opts ...sql.OrderTermOption) OrderOption {
  435. return sql.OrderByField(FieldIPAddress, opts...).ToFunc()
  436. }
  437. // ByImageCount orders the results by the image_count field.
  438. func ByImageCount(opts ...sql.OrderTermOption) OrderOption {
  439. return sql.OrderByField(FieldImageCount, opts...).ToFunc()
  440. }
  441. // ByImageSize orders the results by the image_size field.
  442. func ByImageSize(opts ...sql.OrderTermOption) OrderOption {
  443. return sql.OrderByField(FieldImageSize, opts...).ToFunc()
  444. }
  445. // ByImageInputSize orders the results by the image_input_size field.
  446. func ByImageInputSize(opts ...sql.OrderTermOption) OrderOption {
  447. return sql.OrderByField(FieldImageInputSize, opts...).ToFunc()
  448. }
  449. // ByImageOutputSize orders the results by the image_output_size field.
  450. func ByImageOutputSize(opts ...sql.OrderTermOption) OrderOption {
  451. return sql.OrderByField(FieldImageOutputSize, opts...).ToFunc()
  452. }
  453. // ByImageSizeSource orders the results by the image_size_source field.
  454. func ByImageSizeSource(opts ...sql.OrderTermOption) OrderOption {
  455. return sql.OrderByField(FieldImageSizeSource, opts...).ToFunc()
  456. }
  457. // ByVideoCount orders the results by the video_count field.
  458. func ByVideoCount(opts ...sql.OrderTermOption) OrderOption {
  459. return sql.OrderByField(FieldVideoCount, opts...).ToFunc()
  460. }
  461. // ByVideoResolution orders the results by the video_resolution field.
  462. func ByVideoResolution(opts ...sql.OrderTermOption) OrderOption {
  463. return sql.OrderByField(FieldVideoResolution, opts...).ToFunc()
  464. }
  465. // ByVideoDurationSeconds orders the results by the video_duration_seconds field.
  466. func ByVideoDurationSeconds(opts ...sql.OrderTermOption) OrderOption {
  467. return sql.OrderByField(FieldVideoDurationSeconds, opts...).ToFunc()
  468. }
  469. // ByCacheTTLOverridden orders the results by the cache_ttl_overridden field.
  470. func ByCacheTTLOverridden(opts ...sql.OrderTermOption) OrderOption {
  471. return sql.OrderByField(FieldCacheTTLOverridden, opts...).ToFunc()
  472. }
  473. // ByCreatedAt orders the results by the created_at field.
  474. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  475. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  476. }
  477. // ByUserField orders the results by user field.
  478. func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
  479. return func(s *sql.Selector) {
  480. sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
  481. }
  482. }
  483. // ByAPIKeyField orders the results by api_key field.
  484. func ByAPIKeyField(field string, opts ...sql.OrderTermOption) OrderOption {
  485. return func(s *sql.Selector) {
  486. sqlgraph.OrderByNeighborTerms(s, newAPIKeyStep(), sql.OrderByField(field, opts...))
  487. }
  488. }
  489. // ByAccountField orders the results by account field.
  490. func ByAccountField(field string, opts ...sql.OrderTermOption) OrderOption {
  491. return func(s *sql.Selector) {
  492. sqlgraph.OrderByNeighborTerms(s, newAccountStep(), sql.OrderByField(field, opts...))
  493. }
  494. }
  495. // ByGroupField orders the results by group field.
  496. func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
  497. return func(s *sql.Selector) {
  498. sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
  499. }
  500. }
  501. // BySubscriptionField orders the results by subscription field.
  502. func BySubscriptionField(field string, opts ...sql.OrderTermOption) OrderOption {
  503. return func(s *sql.Selector) {
  504. sqlgraph.OrderByNeighborTerms(s, newSubscriptionStep(), sql.OrderByField(field, opts...))
  505. }
  506. }
  507. func newUserStep() *sqlgraph.Step {
  508. return sqlgraph.NewStep(
  509. sqlgraph.From(Table, FieldID),
  510. sqlgraph.To(UserInverseTable, FieldID),
  511. sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
  512. )
  513. }
  514. func newAPIKeyStep() *sqlgraph.Step {
  515. return sqlgraph.NewStep(
  516. sqlgraph.From(Table, FieldID),
  517. sqlgraph.To(APIKeyInverseTable, FieldID),
  518. sqlgraph.Edge(sqlgraph.M2O, true, APIKeyTable, APIKeyColumn),
  519. )
  520. }
  521. func newAccountStep() *sqlgraph.Step {
  522. return sqlgraph.NewStep(
  523. sqlgraph.From(Table, FieldID),
  524. sqlgraph.To(AccountInverseTable, FieldID),
  525. sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
  526. )
  527. }
  528. func newGroupStep() *sqlgraph.Step {
  529. return sqlgraph.NewStep(
  530. sqlgraph.From(Table, FieldID),
  531. sqlgraph.To(GroupInverseTable, FieldID),
  532. sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
  533. )
  534. }
  535. func newSubscriptionStep() *sqlgraph.Step {
  536. return sqlgraph.NewStep(
  537. sqlgraph.From(Table, FieldID),
  538. sqlgraph.To(SubscriptionInverseTable, FieldID),
  539. sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionTable, SubscriptionColumn),
  540. )
  541. }