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

Fetch an enum stored by its raw value by specifying the case #15

Open
ABridoux opened this issue Nov 20, 2020 · 0 comments
Open

Fetch an enum stored by its raw value by specifying the case #15

ABridoux opened this issue Nov 20, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@ABridoux
Copy link
Contributor

ABridoux commented Nov 20, 2020

It is possible currently to fetch on an attribute with is destined to be converted an an enum value:

Animal.request().all().where(\.type == AnimalType.duck.rawValue)

It would be nice to be able to remove the boilerplate.

Animal.request().all().where(\.type == .duck)

To do so, maybe the Predicate struct should hold another generic DatabaseModel type since the mapping from a raw value to a enum is known in the model.

@ABridoux ABridoux added the enhancement New feature or request label Nov 20, 2020
@ABridoux ABridoux added this to the 0.3.0 milestone Nov 20, 2020
@ABridoux ABridoux removed this from the 0.3.0 milestone Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant