// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.29.0 // source: report.sql package dbgen import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const GetTotalBetsMadeInRange = `-- name: GetTotalBetsMadeInRange :one SELECT COUNT(*) AS total_bets FROM bets WHERE created_at BETWEEN $1 AND $2 AND ( company_id = $3 OR $3 IS NULL ) ` type GetTotalBetsMadeInRangeParams struct { From pgtype.Timestamp `json:"from"` To pgtype.Timestamp `json:"to"` CompanyID pgtype.Int8 `json:"company_id"` } func (q *Queries) GetTotalBetsMadeInRange(ctx context.Context, arg GetTotalBetsMadeInRangeParams) (int64, error) { row := q.db.QueryRow(ctx, GetTotalBetsMadeInRange, arg.From, arg.To, arg.CompanyID) var total_bets int64 err := row.Scan(&total_bets) return total_bets, err } const GetTotalCashBacksInRange = `-- name: GetTotalCashBacksInRange :one SELECT COALESCE(SUM(amount), 0) AS total_cash_backs FROM bets WHERE created_at BETWEEN $1 AND $2 AND status = 5 AND ( company_id = $3 OR $3 IS NULL ) ` type GetTotalCashBacksInRangeParams struct { From pgtype.Timestamp `json:"from"` To pgtype.Timestamp `json:"to"` CompanyID pgtype.Int8 `json:"company_id"` } func (q *Queries) GetTotalCashBacksInRange(ctx context.Context, arg GetTotalCashBacksInRangeParams) (interface{}, error) { row := q.db.QueryRow(ctx, GetTotalCashBacksInRange, arg.From, arg.To, arg.CompanyID) var total_cash_backs interface{} err := row.Scan(&total_cash_backs) return total_cash_backs, err } const GetTotalCashMadeInRange = `-- name: GetTotalCashMadeInRange :one SELECT COALESCE(SUM(amount), 0) AS total_cash_made FROM bets WHERE created_at BETWEEN $1 AND $2 AND ( company_id = $3 OR $3 IS NULL ) ` type GetTotalCashMadeInRangeParams struct { From pgtype.Timestamp `json:"from"` To pgtype.Timestamp `json:"to"` CompanyID pgtype.Int8 `json:"company_id"` } func (q *Queries) GetTotalCashMadeInRange(ctx context.Context, arg GetTotalCashMadeInRangeParams) (interface{}, error) { row := q.db.QueryRow(ctx, GetTotalCashMadeInRange, arg.From, arg.To, arg.CompanyID) var total_cash_made interface{} err := row.Scan(&total_cash_made) return total_cash_made, err } const GetTotalCashOutInRange = `-- name: GetTotalCashOutInRange :one SELECT COALESCE(SUM(amount), 0) AS total_cash_out FROM bets WHERE created_at BETWEEN $1 AND $2 AND cashed_out = true AND ( company_id = $3 OR $3 IS NULL ) ` type GetTotalCashOutInRangeParams struct { From pgtype.Timestamp `json:"from"` To pgtype.Timestamp `json:"to"` CompanyID pgtype.Int8 `json:"company_id"` } func (q *Queries) GetTotalCashOutInRange(ctx context.Context, arg GetTotalCashOutInRangeParams) (interface{}, error) { row := q.db.QueryRow(ctx, GetTotalCashOutInRange, arg.From, arg.To, arg.CompanyID) var total_cash_out interface{} err := row.Scan(&total_cash_out) return total_cash_out, err }