aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/game/hub.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-29 03:06:44 +0900
committernsfisis <nsfisis@gmail.com>2024-07-29 03:06:44 +0900
commit19b19e7f48d6375806f827713a98cffd2c57a434 (patch)
tree5b68e70a65a2434517c7e1ea5ea330fd686049d4 /backend/game/hub.go
parentd1c8aa42aec32c8b042ae32d249df9c3c969453d (diff)
downloadphperkaigi-2025-albatross-19b19e7f48d6375806f827713a98cffd2c57a434.tar.gz
phperkaigi-2025-albatross-19b19e7f48d6375806f827713a98cffd2c57a434.tar.zst
phperkaigi-2025-albatross-19b19e7f48d6375806f827713a98cffd2c57a434.zip
refactor(backend): enable emit_pointers_for_null_types in sqlc
Diffstat (limited to 'backend/game/hub.go')
-rw-r--r--backend/game/hub.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/backend/game/hub.go b/backend/game/hub.go
index c61f2bb..d4a9231 100644
--- a/backend/game/hub.go
+++ b/backend/game/hub.go
@@ -240,14 +240,14 @@ func (hubs *GameHubs) RestoreFromDB(ctx context.Context) error {
startedAt = &row.StartedAt.Time
}
var problem_ *problem
- if row.ProblemID.Valid {
- if !row.Title.Valid || !row.Description.Valid {
+ if row.ProblemID != nil {
+ if row.Title == nil || row.Description == nil {
panic("inconsistent data")
}
problem_ = &problem{
- problemID: int(row.ProblemID.Int32),
- title: row.Title.String,
- description: row.Description.String,
+ problemID: int(*row.ProblemID),
+ title: *row.Title,
+ description: *row.Description,
}
}
hubs.hubs[int(row.GameID)] = newGameHub(ctx, &game{