From 19b19e7f48d6375806f827713a98cffd2c57a434 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 29 Jul 2024 03:06:44 +0900 Subject: refactor(backend): enable emit_pointers_for_null_types in sqlc --- backend/game/hub.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'backend/game/hub.go') 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{ -- cgit v1.2.3-70-g09d2