// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.27.0
// source: song_list.sql

package repository

import (
	"context"
	"time"
)

const getSongList = `-- name: GetSongList :many
SELECT match_date, match_id, song_no, game_name, song_name
FROM song_list
WHERE match_date = $1
ORDER BY song_no DESC
`

func (q *Queries) GetSongList(ctx context.Context, matchDate time.Time) ([]SongList, error) {
	rows, err := q.db.Query(ctx, getSongList, matchDate)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []SongList
	for rows.Next() {
		var i SongList
		if err := rows.Scan(
			&i.MatchDate,
			&i.MatchID,
			&i.SongNo,
			&i.GameName,
			&i.SongName,
		); err != nil {
			return nil, err
		}
		items = append(items, i)
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}

const insertSongInList = `-- name: InsertSongInList :exec
INSERT INTO song_list (match_date, match_id, song_no, game_name, song_name)
VALUES ($1, $2, $3, $4, $5)
`

type InsertSongInListParams struct {
	MatchDate time.Time `json:"match_date"`
	MatchID   int32     `json:"match_id"`
	SongNo    int32     `json:"song_no"`
	GameName  *string   `json:"game_name"`
	SongName  *string   `json:"song_name"`
}

func (q *Queries) InsertSongInList(ctx context.Context, arg InsertSongInListParams) error {
	_, err := q.db.Exec(ctx, insertSongInList,
		arg.MatchDate,
		arg.MatchID,
		arg.SongNo,
		arg.GameName,
		arg.SongName,
	)
	return err
}
