Fix lastSession always return an error

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-19 17:38:44 +01:00
parent 0c79bf4b9b
commit 393343e557
8 changed files with 84 additions and 30 deletions

View File

@@ -348,15 +348,15 @@ WHERE
rows, err := conn.Query(ctx, q, args)
if err != nil {
if err == pgx.ErrNoRows {
return ErrResourceNotFound
}
return fmt.Errorf("cannot query session: %w", err)
}
session, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Session])
if err != nil {
if err == pgx.ErrNoRows {
return ErrResourceNotFound
}
return fmt.Errorf("cannot collect session: %w", err)
}