Skip to content

Can't override with type in same package #177

Closed
@mightyguava

Description

@mightyguava

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions