You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The types in a query are not overwritten. I want to overwrite the "real" type in the following query with a a sql.NullFloat64 in the go code.
The P75 is parsed into a go float32 field wich explodes if the value is NULL
type GetUrlLCPPercentilesRow struct {
P75 float32
One interface{}
}
func (q *Queries) GetUrlLCPPercentiles(ctx context.Context, arg GetUrlLCPPercentilesParams) (GetUrlLCPPercentilesRow, error) {
row := q.db.QueryRowContext(ctx, getUrlLCPPercentiles, arg.Auth0id, arg.StartDate, arg.EndDate)
var i GetUrlLCPPercentilesRow
err := row.Scan(&i.P75, &i.One)
return i, err
}
Now I tried to use an overwrite to get rid of this problem (see config below), but sadly the type of P75 is not adapted to sql.NullFloat64 as expected.
Relevant log output
No response
Database schema
No response
SQL queries
-- name: GetUrlLCPPercentiles :oneSELECT percentile_disc(0.75) WITHIN GROUP(ORDER BY lcp)::real P75, 1as one
FROM event
WHERE lcp IS NOT NULLAND
auth0id = $1ANDdate(created_at) >=date(sqlc.arg(start_date)::date) ANDdate(created_at) <=date(sqlc.arg(end_date)::date);
Version
1.11.0
What happened?
The types in a query are not overwritten. I want to overwrite the "real" type in the following query with a a
sql.NullFloat64
in the go code.The P75 is parsed into a go
float32
field wich explodes if the value isNULL
Now I tried to use an overwrite to get rid of this problem (see config below), but sadly the type of
P75
is not adapted tosql.NullFloat64
as expected.Relevant log output
No response
Database schema
No response
SQL queries
Configuration
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: