Skip to content

Feature req: support string enumsΒ #89

Open
@Proximyst

Description

Hi! I have a use-case where I want to use enumer to map postgres enums with the -sql flag. There may be conflicts in my enums, hence I cannot declare multiple enums in the same package.

Example:

//go:generate ...
type EnumA int
const (
    Test EnumA = iota
    Cool EnumA
)

//go:generate ...
type EnumB int
const (
    VeryCool EnumB = iota
    Cool EnumB // this will cause issues!
)

It would be neat if we could instead declare the values as strings, e.g.:

//go:generate ...
type EnumA string
const (
    ATest EnumA = "TEST"
    ACool EnumA = "COOL"
)

//go:generate ...
type EnumB string
const (
    BVeryCool EnumB = "VERY_COOL"
    BCool EnumB = "COOL"
)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions