-
-
Notifications
You must be signed in to change notification settings - Fork 519
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
Enumeration #252
Closed
2 of 3 tasks
Milestone
Comments
This was referenced Oct 17, 2021
Merged
Merged
1 task
Merged
1 task
billy1624
added a commit
to SeaQL/seaql.github.io
that referenced
this issue
Nov 17, 2021
billy1624
added a commit
to SeaQL/seaql.github.io
that referenced
this issue
Nov 18, 2021
tyt2y3
pushed a commit
to SeaQL/seaql.github.io
that referenced
this issue
Nov 19, 2021
* Draft "What's new in SeaORM 0.4.0" * Disable SQLx logging (SeaQL/sea-orm#290) * Refactor `Schema` (SeaQL/sea-orm#309) * ActiveEnum (SeaQL/sea-orm#252) * ActiveEnum (SeaQL/sea-orm#252) * Move * Move * Update docs link * Self referencing * Move * Generating database schema * Generating database schema * Change date * Edit * Edit
arpancodes
pushed a commit
to arpancodes/sea-orm
that referenced
this issue
Apr 8, 2022
Insert Default (SeaQL#223)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue is to outline the design of how to allow custom Enums to be used in SeaORM Entity.
It will be supported in 3 steps:
A proposed trait
ActiveEnum
(orDbEnum
orOrmEnum
etc) would be:A sample model would be like:
Such a trait should be all it takes for using a custom enum (we need to eliminate all boilerplate as in #196 (reply in thread)). And it will be converted automatically during Select, Insert and Update.
We can also make a
DeriveActiveEnum
macro to make it easier:(because of the excess
String("B")
, we'd better divide into string_value and num_value)After some discussion with @acidic9, to support native enum in Postgres, we basically have to cast everywhere:
For MySQL, casting is not needed.
Ref: #196
The text was updated successfully, but these errors were encountered: