Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature req: support string enums #89

Open
Proximyst opened this issue Feb 26, 2024 · 0 comments
Open

Feature req: support string enums #89

Proximyst opened this issue Feb 26, 2024 · 0 comments

Comments

@Proximyst
Copy link

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"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant