aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/query.sql.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-10 19:55:28 +0900
committernsfisis <nsfisis@gmail.com>2024-08-10 19:55:50 +0900
commit47f95342097e8828059053c168e06cd44e0ab43b (patch)
tree843d09397ccc1e5ec36c926e3eb555e1d6e5ed52 /backend/db/query.sql.go
parent0b520dc2529d7df6263842480d4ba7eaf07f4dcd (diff)
downloadphperkaigi-2025-albatross-47f95342097e8828059053c168e06cd44e0ab43b.tar.gz
phperkaigi-2025-albatross-47f95342097e8828059053c168e06cd44e0ab43b.tar.zst
phperkaigi-2025-albatross-47f95342097e8828059053c168e06cd44e0ab43b.zip
feat(backend): include `verification_steps` in `Game` object
Diffstat (limited to 'backend/db/query.sql.go')
-rw-r--r--backend/db/query.sql.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go
index 392e6a6..cbef51d 100644
--- a/backend/db/query.sql.go
+++ b/backend/db/query.sql.go
@@ -403,6 +403,32 @@ func (q *Queries) ListGamesForPlayer(ctx context.Context, userID int32) ([]ListG
return items, nil
}
+const listTestcaseIDsByGameID = `-- name: ListTestcaseIDsByGameID :many
+SELECT testcases.testcase_id FROM testcases
+WHERE testcases.problem_id = (SELECT problem_id FROM games WHERE game_id = $1)
+ORDER BY testcases.testcase_id
+`
+
+func (q *Queries) ListTestcaseIDsByGameID(ctx context.Context, gameID int32) ([]int32, error) {
+ rows, err := q.db.Query(ctx, listTestcaseIDsByGameID, gameID)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ var items []int32
+ for rows.Next() {
+ var testcase_id int32
+ if err := rows.Scan(&testcase_id); err != nil {
+ return nil, err
+ }
+ items = append(items, testcase_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)