Skip to content

[Feature Request] Add support for string conversion from enum aliases Β #94

Open
@janpfeifer

Description

Would it make sense to add support for enum aliases ?

Example:

type MyType int

const (
  A MyType = iota
  B
)

const (
  AlsoA = A
  BInSpanish = B
)

And then have a call to MyTypeString("AlsoA") -> A and MyTypeString("BInSpanish") -> B ?

My concrete use case: I'm adding support to various naming schemes for data types (dtype) for machine learning frameworks, see this file, and the community doesn't seem to agree on one naming convention for these things. I was hopping to leverage enumer to handle the conversion from string also for the aliases.

ps.: Btw, thanks for writing and maintaining enumer!

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