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

User Prisma enums don't derive PartialEq #217

Closed
styxpilled opened this issue Dec 7, 2022 · 3 comments · Fixed by #218
Closed

User Prisma enums don't derive PartialEq #217

styxpilled opened this issue Dec 7, 2022 · 3 comments · Fixed by #218

Comments

@styxpilled
Copy link

Comparing enums generated from Prisma enums is currently a bit annoying since you can't compare them directly with ==, and matching them indents your code more.
I feel like they should derive PartialEq and Eq.

enum Stuff {
  ONE
  TWO
  THREE
}
if thing == Stuff::One /* binary operation `==` cannot be applied to type `prisma::Thing`  */ {
    // ...
}

Without it, the workaround is to use match or convert the values to a string with .to_string() and compare that.

@Brendonovich Brendonovich added this to the 0.6.4 milestone Dec 7, 2022
@Brendonovich
Copy link
Owner

That's a good point, in the meantime I'd suggest using matches!.

@Brendonovich Brendonovich linked a pull request Dec 9, 2022 that will close this issue
@Brendonovich Brendonovich removed a link to a pull request Dec 9, 2022
@Brendonovich Brendonovich linked a pull request Dec 9, 2022 that will close this issue
@Brendonovich
Copy link
Owner

@styxpilled Does using rev = "81fa36256e7cfab4c83128a5c3a1eaf2f1d55bcb" instead of tag = "0.6.3" work for you?

@styxpilled
Copy link
Author

Yeap, that works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants