sorarebuddy/model/fixture.sql.go

78 lines
1.6 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: fixture.sql
package model
import (
"context"
)
const getAllFixtures = `-- name: GetAllFixtures :many
SELECT slug, display_name, state, start_date, end_date, game_week FROM fixtures
`
func (q *Queries) GetAllFixtures(ctx context.Context) ([]Fixture, error) {
rows, err := q.db.Query(ctx, getAllFixtures)
if err != nil {
return nil, err
}
defer rows.Close()
var items []Fixture
for rows.Next() {
var i Fixture
if err := rows.Scan(
&i.Slug,
&i.DisplayName,
&i.State,
&i.StartDate,
&i.EndDate,
&i.GameWeek,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const getFixtureByGameWeek = `-- name: GetFixtureByGameWeek :one
SELECT slug, display_name, state, start_date, end_date, game_week FROM fixtures WHERE game_week = $1
`
func (q *Queries) GetFixtureByGameWeek(ctx context.Context, gameWeek int32) (Fixture, error) {
row := q.db.QueryRow(ctx, getFixtureByGameWeek, gameWeek)
var i Fixture
err := row.Scan(
&i.Slug,
&i.DisplayName,
&i.State,
&i.StartDate,
&i.EndDate,
&i.GameWeek,
)
return i, err
}
const getFixtureBySlug = `-- name: GetFixtureBySlug :one
SELECT slug, display_name, state, start_date, end_date, game_week FROM fixtures WHERE slug = $1
`
func (q *Queries) GetFixtureBySlug(ctx context.Context, slug string) (Fixture, error) {
row := q.db.QueryRow(ctx, getFixtureBySlug, slug)
var i Fixture
err := row.Scan(
&i.Slug,
&i.DisplayName,
&i.State,
&i.StartDate,
&i.EndDate,
&i.GameWeek,
)
return i, err
}