Closed mvrahden closed 2 years ago
Hi @dmarkham, would be nice to hear your opinion on this. Thanks :)
I think a new flag to add this method would be just fine.
great! I'll prepare a PR
On Thu, Oct 21, 2021 at 2:39 AM Dan Markham @.***> wrote:
I think a new flag yo add this method would be just fine.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dmarkham/enumer/issues/50#issuecomment-948139183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMIMCRBJPHMVN745QZTBJ3UH5OKXANCNFSM5GEW67FA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@dmarkham please have a look at #51 thanks
@dmarkham Thanks for merging! Would you mind bumping the patch version?
@dmarkham pls bump version, so that the changes make it into the release. Thanks!
Hi, to improve interoperability with ent and support its enum type-safety, I'd propose to add the
Values() []string
method (from the EnumValues interface) to the generated enum types, next toString() string
. This feature should likely be opt-in, so it would be beneficial to add a flag for it. I'd propose-values
(or-valuesFunc
) flag.I've seen, there is already a generated
***Strings() []string
-func, which would just need to be wrapped by theValues() []string
method in question.@dmarkham Would you be open for a PR for this?
An Example:
P.S.: I understand there's a potential for confusion, due to the pre-existing
PillValues() []Pill
function. But to have typesafety with enums in ent, this proposal is the only way to go from what I see.