diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-10 00:25:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-10 00:25:42 +0900 |
| commit | c807d6e47b11a91ec56225ed8358e3f2ef903e5c (patch) | |
| tree | 9eee9b70f5c063a9c9e887919fc12f9ac38ca6c2 /backend | |
| parent | 87ffe8514a1cdd48ce1660c63c021e5f30540184 (diff) | |
| download | iosdc-japan-2025-albatross-c807d6e47b11a91ec56225ed8358e3f2ef903e5c.tar.gz iosdc-japan-2025-albatross-c807d6e47b11a91ec56225ed8358e3f2ef903e5c.tar.zst iosdc-japan-2025-albatross-c807d6e47b11a91ec56225ed8358e3f2ef903e5c.zip | |
refactor(backend): remove unused db queries
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/db/query.sql.go | 65 | ||||
| -rw-r--r-- | backend/query.sql | 15 |
2 files changed, 0 insertions, 80 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index 980928a..a7b8f74 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -326,19 +326,6 @@ func (q *Queries) GetRanking(ctx context.Context, gameID int32) ([]GetRankingRow return items, nil } -const getSubmissionCodeSizeByID = `-- name: GetSubmissionCodeSizeByID :one -SELECT code_size FROM submissions -WHERE submission_id = $1 -LIMIT 1 -` - -func (q *Queries) GetSubmissionCodeSizeByID(ctx context.Context, submissionID int32) (int32, error) { - row := q.db.QueryRow(ctx, getSubmissionCodeSizeByID, submissionID) - var code_size int32 - err := row.Scan(&code_size) - return code_size, err -} - const getUserAuthByUsername = `-- name: GetUserAuthByUsername :one SELECT users.user_id, username, display_name, icon_path, is_admin, created_at, user_auth_id, user_auths.user_id, auth_type, password_hash FROM users JOIN user_auths ON users.user_id = user_auths.user_id @@ -444,32 +431,6 @@ func (q *Queries) ListAllGames(ctx context.Context) ([]Game, error) { return items, nil } -const listMainPlayerIDs = `-- name: ListMainPlayerIDs :many -SELECT user_id FROM game_main_players -WHERE game_id = $1 -ORDER BY user_id -` - -func (q *Queries) ListMainPlayerIDs(ctx context.Context, gameID int32) ([]int32, error) { - rows, err := q.db.Query(ctx, listMainPlayerIDs, gameID) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var user_id int32 - if err := rows.Scan(&user_id); err != nil { - return nil, err - } - items = append(items, user_id) - } - 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, created_at FROM game_main_players JOIN users ON game_main_players.user_id = users.user_id @@ -572,32 +533,6 @@ func (q *Queries) ListPublicGames(ctx context.Context) ([]ListPublicGamesRow, er 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) diff --git a/backend/query.sql b/backend/query.sql index 192bf41..dbf050b 100644 --- a/backend/query.sql +++ b/backend/query.sql @@ -70,26 +70,11 @@ JOIN users ON game_main_players.user_id = users.user_id WHERE game_main_players.game_id = ANY($1::INT[]) ORDER BY game_main_players.user_id; --- name: ListMainPlayerIDs :many -SELECT user_id FROM game_main_players -WHERE game_id = $1 -ORDER BY user_id; - --- name: GetSubmissionCodeSizeByID :one -SELECT code_size FROM submissions -WHERE submission_id = $1 -LIMIT 1; - -- name: ListTestcasesByGameID :many SELECT * FROM testcases WHERE testcases.problem_id = (SELECT problem_id FROM games WHERE game_id = $1) ORDER BY testcases.testcase_id; --- 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; - -- name: CreateTestcaseResult :exec INSERT INTO testcase_results (submission_id, testcase_id, status, stdout, stderr) VALUES ($1, $2, $3, $4, $5); |
