aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/query.sql.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/db/query.sql.go')
-rw-r--r--backend/db/query.sql.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go
index fece99f..d4e134f 100644
--- a/backend/db/query.sql.go
+++ b/backend/db/query.sql.go
@@ -496,6 +496,35 @@ func (q *Queries) ListAllGames(ctx context.Context) ([]Game, error) {
return items, nil
}
+const listGameStateIDs = `-- name: ListGameStateIDs :many
+SELECT game_id, user_id FROM game_states
+`
+
+type ListGameStateIDsRow struct {
+ GameID int32
+ UserID int32
+}
+
+func (q *Queries) ListGameStateIDs(ctx context.Context) ([]ListGameStateIDsRow, error) {
+ rows, err := q.db.Query(ctx, listGameStateIDs)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ var items []ListGameStateIDsRow
+ for rows.Next() {
+ var i ListGameStateIDsRow
+ if err := rows.Scan(&i.GameID, &i.UserID); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const listMainPlayers = `-- name: ListMainPlayers :many
SELECT game_id, game_main_players.user_id, users.user_id, username, display_name, icon_path, is_admin, label, created_at FROM game_main_players
JOIN users ON game_main_players.user_id = users.user_id
@@ -600,6 +629,30 @@ func (q *Queries) ListPublicGames(ctx context.Context) ([]ListPublicGamesRow, er
return items, nil
}
+const listSubmissionIDs = `-- name: ListSubmissionIDs :many
+SELECT submission_id FROM submissions
+`
+
+func (q *Queries) ListSubmissionIDs(ctx context.Context) ([]int32, error) {
+ rows, err := q.db.Query(ctx, listSubmissionIDs)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ var items []int32
+ for rows.Next() {
+ var submission_id int32
+ if err := rows.Scan(&submission_id); err != nil {
+ return nil, err
+ }
+ items = append(items, submission_id)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const listTestcasesByGameID = `-- name: ListTestcasesByGameID :many
SELECT testcase_id, problem_id, stdin, stdout FROM testcases
WHERE testcases.problem_id = (SELECT problem_id FROM games WHERE game_id = $1)