Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Nullable types for computed columns?#1030

Unanswered
gabrielhora asked this question inQ&A
Discussion options

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 viaoverrides in sqlc.yaml, is there a way to do the same for queries?

This is a simple example,min andmax may return null. How can I deal with this in sqlc?

consttest=`-- name: Test :oneselect min(age)::int as min_age, max(age)::int as max_age from my_table`typeTestRowstruct {MinAgeint32MaxAgeint32}func (q*Queries)Test(ctx context.Context) (TestRow,error) {row:=q.db.QueryRowContext(ctx,test)variTestRowerr:=row.Scan(&i.MinAge,&i.MaxAge)returni,err}

Thanks a lot for your time.

You must be logged in to vote

Replies: 1 comment

Comment options

no response? may i know why?

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@gabrielhora@nmsobri

[8]ページ先頭

©2009-2025 Movatter.jp