Something went wrong. Try again.
the coolest token pot ever
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100// Code generated by sqlc. DO NOT EDIT.// versions:// sqlc v1.31.1// source: pool.sql
package store
import ( "context")
const poolActiveKeyCount = `-- name: PoolActiveKeyCount :oneSELECT COUNT(*) FROM pool_keys WHERE active = 1 AND revoked_at IS NULL`
func (q *Queries) PoolActiveKeyCount(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, poolActiveKeyCount) var count int64 err := row.Scan(&count) return count, err}
const poolContributorCount = `-- name: PoolContributorCount :oneSELECT COUNT(DISTINCT user_id)FROM pool_keysWHERE active = 1 AND revoked_at IS NULL`
// Users who own at least one active pool key.func (q *Queries) PoolContributorCount(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, poolContributorCount) var count int64 err := row.Scan(&count) return count, err}
const poolSpentSince = `-- name: PoolSpentSince :oneSELECT COALESCE(SUM(cost_micros), 0)FROM pool_key_billing_rowsWHERE pioneer_created_at >= ? AND is_duplicate = 0`
// Spend (cost_micros) from billing rows since the given unix timestamp.// Excludes duplicates.func (q *Queries) PoolSpentSince(ctx context.Context, pioneerCreatedAt int64) (interface{}, error) { row := q.db.QueryRowContext(ctx, poolSpentSince, pioneerCreatedAt) var coalesce interface{} err := row.Scan(&coalesce) return coalesce, err}
const poolTokensGuzzled = `-- name: PoolTokensGuzzled :oneSELECT COALESCE(SUM(token_usage), 0) AS input_tokens, 0 AS output_tokensFROM pool_key_billing_rowsWHERE is_duplicate = 0`
type PoolTokensGuzzledRow struct { InputTokens interface{} `json:"input_tokens"` OutputTokens int64 `json:"output_tokens"`}
// token_usage is the total per row; split evenly across input/output so// the caller's inTok+outTok sum equals the real total.func (q *Queries) PoolTokensGuzzled(ctx context.Context) (PoolTokensGuzzledRow, error) { row := q.db.QueryRowContext(ctx, poolTokensGuzzled) var i PoolTokensGuzzledRow err := row.Scan(&i.InputTokens, &i.OutputTokens) return i, err}
const poolTotalBalance = `-- name: PoolTotalBalance :one
SELECT COALESCE(SUM(pioneer_credit_limit_micros), 0) AS balance_microsFROM pool_keysWHERE active = 1 AND revoked_at IS NULL`
// Pool-wide aggregates. Used by the public splash page; no auth required.// Total pioneer credit limit across all active pool keys.func (q *Queries) PoolTotalBalance(ctx context.Context) (interface{}, error) { row := q.db.QueryRowContext(ctx, poolTotalBalance) var balance_micros interface{} err := row.Scan(&balance_micros) return balance_micros, err}
const poolUserCount = `-- name: PoolUserCount :oneSELECT COUNT(*) FROM users`
func (q *Queries) PoolUserCount(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, poolUserCount) var count int64 err := row.Scan(&count) return count, err}