Skip to content

Get list of enum keys or values #1

@synalysis

Description

@synalysis

I'm glad I found this module since from my point of view it fills a gap in Elixir - ensure that different modules refer to the same values and don't use atoms like "magic numbers" that hopefully match.

There's just one extension I'd consider useful, for example to be used with Ecto's validate_inclusion() function. If all values (and keys) of an enum could be retrieved for an enum it would avoid the necessity to define an extra constant for this list (as shown in the sample code).

Any opinions on this?

Metadata

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