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
Queries using conditional expressions like NULLIF and COALESCE generate proper Go code. Meanwhile, the CASE conditional expression does not. The generated go code doesn't generate an additional field in the result struct, making the Scan fail each time is called. I will try to investigate this issue later on the week and try to provide a fix. The following query can be used to reproduce the observed behavior:
SELECT
id,
CASE
WHEN id = $1 THEN true
ELSE false
END is_one
FROM
author;
Actually, NULLIF also smells bad. When using it in a query, the Go struct is generated with a field with the bool type, instead of a Null* type. The following query:
Activity
eullerpereira94 commentedon Sep 30, 2019
Actually, NULLIF also smells bad. When using it in a query, the Go struct is generated with a field with the bool type, instead of a Null* type. The following query:
Will generate the following strange code:
When correct type would be
sql.NullInt64.kyleconroy commentedon Oct 3, 2019
Yeah, these are indeed two problems. I hope to get a chance to look at them this weekend