Yimaru-BackEnd/gen/db/odds.sql.go
OneTap Technologies 92250d61a8 event and odd data
2025-04-10 16:42:26 +03:00

77 lines
1.5 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.28.0
// source: odds.sql
package dbgen
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const GetUpcomingEventIDs = `-- name: GetUpcomingEventIDs :many
SELECT id FROM events
WHERE is_live = false
`
func (q *Queries) GetUpcomingEventIDs(ctx context.Context) ([]string, error) {
rows, err := q.db.Query(ctx, GetUpcomingEventIDs)
if err != nil {
return nil, err
}
defer rows.Close()
var items []string
for rows.Next() {
var id string
if err := rows.Scan(&id); err != nil {
return nil, err
}
items = append(items, id)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const InsertNonLiveOdd = `-- name: InsertNonLiveOdd :exec
INSERT INTO odds (
event_id, market_type, header, name, odds_value, handicap,
section, category, market_id, is_active, source, fetched_at, raw_event_id
) VALUES (
$1, $2, $3, $4, $5, $6,
$7, $8, $9, true, 'b365api', now(), $10
)
`
type InsertNonLiveOddParams struct {
EventID pgtype.Text
MarketType string
Header pgtype.Text
Name pgtype.Text
OddsValue pgtype.Float8
Handicap pgtype.Text
Section string
Category pgtype.Text
MarketID pgtype.Text
RawEventID pgtype.Text
}
func (q *Queries) InsertNonLiveOdd(ctx context.Context, arg InsertNonLiveOddParams) error {
_, err := q.db.Exec(ctx, InsertNonLiveOdd,
arg.EventID,
arg.MarketType,
arg.Header,
arg.Name,
arg.OddsValue,
arg.Handicap,
arg.Section,
arg.Category,
arg.MarketID,
arg.RawEventID,
)
return err
}