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
When I run sqlc generate with engine: "mysql and I use sqlc.slice(myslice) inside queries, in the generated file with Go code it inserts an import of "github.com/lib/pq" but it is not used in any code so my app does not compile after that.
It happens only when I use it in combination with sqlc.narg(myslice) because I want to ensure that if the argument is null I do not need to filter by it.
The problem is reproducible in the online playground, please look at the link I've attached. Thanks!
Also, could you please guide me maybe how could I use sqlc.slice() to filter by it only in case if there are some elements in the slice? I see the current version of the code generation replaces the slice to NULL in the final SQL, how to use it correctly in that case?
Should it be something like that?
where
coalesce(name in (sqlc.slice(names)), true);
Version
1.26.0
What happened?
When I run
sqlc generate
withengine: "mysql
and I usesqlc.slice(myslice)
inside queries, in the generated file with Go code it inserts an import of"github.com/lib/pq"
but it is not used in any code so my app does not compile after that.It happens only when I use it in combination with
sqlc.narg(myslice)
because I want to ensure that if the argument is null I do not need to filter by it.The problem is reproducible in the online playground, please look at the link I've attached. Thanks!
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
https://play.sqlc.dev/p/96994ab9c5be500a74b65ba1e9e870a7dce1fccfae8bc2956909cba197698c5f
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: