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
It's convenient to have enums.go in the same package as the generated code, but there doesn't seem to be a way to tell the generator to not create an import. I end up with the package importing itself which Go reports as an import cycle.
Indeed, for some reason the enum type is NOT set as the struct field type in some cases.
Don't know exactly why.
In order to fix this I tried to set an override, but unfortunately I can't, because the enum from db is generated in the same package as the code using it.
this gives error: import cycle not allowed , because the package where the code is generated, namely: database is trying to import itself via the override.
Activity
alibitek commentedon Mar 11, 2020
Indeed, for some reason the enum type is NOT set as the struct field type in some cases.
Don't know exactly why.
In order to fix this I tried to set an override, but unfortunately I can't, because the enum from db is generated in the same package as the code using it.
First test:
this gives error:
import cycle not allowed, because the package where the code is generated, namely:databaseis trying to import itself via the override.Second test:
this gives error:
cannot load gitlab: cannot find module providing package gitlabInside
querier.goI get a weird import like:Probably because the override has the format:
package.typeand the package is missing.Added test template for sqlc-dev#177 and possible fix idea
kyleconroy commentedon Nov 15, 2020
This should now on main. You'll need to specify the
go_typeusing an object instead of just a string{ "go_type": {"type": "ECustomEnum"}, "db_type": "e_custom_enum" }