Closed
Description
I wanted to create a type for an enum, e.g. State
# job.sql
create table job (
id bigserial primary key,
state int
)
# job.sql.go
type Job struct {
ID string `json:"id"`
State State `json:"state"`
}
# enums.go
type State string
const (
StateRunning State = iota
StateFailed
StateDone
)
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.