diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-05 02:18:22 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-05 03:02:06 +0900 |
| commit | 2705f09f5c52b25af07a1d7ccec546de68ff32e9 (patch) | |
| tree | cc5974fc9041411e842744b6cd527f29db2024ac /backend/db/query.sql.go | |
| parent | ff959dadb1f990173b9df3105ccfc96b1c6c092e (diff) | |
| download | phperkaigi-2025-albatross-2705f09f5c52b25af07a1d7ccec546de68ff32e9.tar.gz phperkaigi-2025-albatross-2705f09f5c52b25af07a1d7ccec546de68ff32e9.tar.zst phperkaigi-2025-albatross-2705f09f5c52b25af07a1d7ccec546de68ff32e9.zip | |
feat(backend): add `game_type` column to `games`
Diffstat (limited to 'backend/db/query.sql.go')
| -rw-r--r-- | backend/db/query.sql.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index 074e767..464d7f8 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -12,7 +12,7 @@ import ( ) const getGameByID = `-- name: GetGameByID :one -SELECT game_id, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description FROM games +SELECT game_id, game_type, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description FROM games LEFT JOIN problems ON games.problem_id = problems.problem_id WHERE games.game_id = $1 LIMIT 1 @@ -20,6 +20,7 @@ LIMIT 1 type GetGameByIDRow struct { GameID int32 + GameType string State string DisplayName string DurationSeconds int32 @@ -36,6 +37,7 @@ func (q *Queries) GetGameByID(ctx context.Context, gameID int32) (GetGameByIDRow var i GetGameByIDRow err := row.Scan( &i.GameID, + &i.GameType, &i.State, &i.DisplayName, &i.DurationSeconds, @@ -108,12 +110,13 @@ func (q *Queries) GetUserByID(ctx context.Context, userID int32) (User, error) { } const listGames = `-- name: ListGames :many -SELECT game_id, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description FROM games +SELECT game_id, game_type, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description FROM games LEFT JOIN problems ON games.problem_id = problems.problem_id ` type ListGamesRow struct { GameID int32 + GameType string State string DisplayName string DurationSeconds int32 @@ -136,6 +139,7 @@ func (q *Queries) ListGames(ctx context.Context) ([]ListGamesRow, error) { var i ListGamesRow if err := rows.Scan( &i.GameID, + &i.GameType, &i.State, &i.DisplayName, &i.DurationSeconds, @@ -157,7 +161,7 @@ func (q *Queries) ListGames(ctx context.Context) ([]ListGamesRow, error) { } const listGamesForPlayer = `-- name: ListGamesForPlayer :many -SELECT games.game_id, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description, game_players.game_id, user_id FROM games +SELECT games.game_id, game_type, state, display_name, duration_seconds, created_at, started_at, games.problem_id, problems.problem_id, title, description, game_players.game_id, user_id FROM games LEFT JOIN problems ON games.problem_id = problems.problem_id JOIN game_players ON games.game_id = game_players.game_id WHERE game_players.user_id = $1 @@ -165,6 +169,7 @@ WHERE game_players.user_id = $1 type ListGamesForPlayerRow struct { GameID int32 + GameType string State string DisplayName string DurationSeconds int32 @@ -189,6 +194,7 @@ func (q *Queries) ListGamesForPlayer(ctx context.Context, userID int32) ([]ListG var i ListGamesForPlayerRow if err := rows.Scan( &i.GameID, + &i.GameType, &i.State, &i.DisplayName, &i.DurationSeconds, |
