alvaroloes / enumer

A Go tool to auto generate methods for your enums
Other
478 stars 111 forks source link

Improvement: Whitespace transform? #40

Closed Xopherus closed 5 years ago

Xopherus commented 5 years ago

Hi Alvaro! I have a use case where I'm trying to model enum types from other systems. Some of these already use snake_case which is great because you've already included that transform here. However one or two of these models use strings which are whitespace separated. Would you agree that that transformer could be added to this library? Thanks so much!

Xopherus commented 5 years ago

Maybe this could be added to #38?

alvaroloes commented 5 years ago

Thank you for reporting your issue!

🤔 White spaces could cause a lot of problems when parsing because it is usually considered a "token" separator. To be honest it is a very strange case that a system uses an enum value that contains white spaces.

Couldn't those one or two cases be changed or handled differently?

Before adding any new feature, I like to first be sure it is going to be useful for the general use cases and avoid including support for very specific cases (as they add a lot of complexity).

alvaroloes commented 5 years ago

@Xopherus Check the latest revision (v1.1.2) you will like it 😉 Now you can have whitespaces in your Enum strings using - linecomment