-
Notifications
You must be signed in to change notification settings - Fork 925
Nullable types for computed columns? #1030
Unanswered
gabrielhora
asked this question in
Q&A
-
Hi there,
I'm trying to come up with a solution for having nullable types for computed columns.
I know I can override table column types via overrides
in sqlc.yaml, is there a way to do the same for queries?
This is a simple example, min
and max
may return null. How can I deal with this in sqlc?
const test = `-- name: Test :one select min(age)::int as min_age, max(age)::int as max_age from my_table ` type TestRow struct { MinAge int32 MaxAge int32 } func (q *Queries) Test(ctx context.Context) (TestRow, error) { row := q.db.QueryRowContext(ctx, test) var i TestRow err := row.Scan(&i.MinAge, &i.MaxAge) return i, err }
Thanks a lot for your time.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 9
Replies: 1 comment
-
no response? may i know why?
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment