67 lines
1.5 KiB
Go
67 lines
1.5 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.28.0
|
|
// source: result.sql
|
|
|
|
package dbgen
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const GetResultByEventID = `-- name: GetResultByEventID :one
|
|
SELECT id, event_id, full_time_score, half_time_score, ss, scores, fetched_at FROM results WHERE event_id = $1
|
|
`
|
|
|
|
func (q *Queries) GetResultByEventID(ctx context.Context, eventID pgtype.Text) (Result, error) {
|
|
row := q.db.QueryRow(ctx, GetResultByEventID, eventID)
|
|
var i Result
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.EventID,
|
|
&i.FullTimeScore,
|
|
&i.HalfTimeScore,
|
|
&i.Ss,
|
|
&i.Scores,
|
|
&i.FetchedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const InsertResult = `-- name: InsertResult :one
|
|
INSERT INTO results (event_id, full_time_score, half_time_score, ss, scores)
|
|
VALUES ($1, $2, $3, $4, $5)
|
|
RETURNING id, event_id, full_time_score, half_time_score, ss, scores, fetched_at
|
|
`
|
|
|
|
type InsertResultParams struct {
|
|
EventID pgtype.Text `json:"event_id"`
|
|
FullTimeScore pgtype.Text `json:"full_time_score"`
|
|
HalfTimeScore pgtype.Text `json:"half_time_score"`
|
|
Ss pgtype.Text `json:"ss"`
|
|
Scores []byte `json:"scores"`
|
|
}
|
|
|
|
func (q *Queries) InsertResult(ctx context.Context, arg InsertResultParams) (Result, error) {
|
|
row := q.db.QueryRow(ctx, InsertResult,
|
|
arg.EventID,
|
|
arg.FullTimeScore,
|
|
arg.HalfTimeScore,
|
|
arg.Ss,
|
|
arg.Scores,
|
|
)
|
|
var i Result
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.EventID,
|
|
&i.FullTimeScore,
|
|
&i.HalfTimeScore,
|
|
&i.Ss,
|
|
&i.Scores,
|
|
&i.FetchedAt,
|
|
)
|
|
return i, err
|
|
}
|