-
-
Notifications
You must be signed in to change notification settings - Fork 521
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 - 2 #261
Merged
Merged
Enumeration - 2 #261
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7346084
WIP
billy1624 80c7200
Try Postgres enum
billy1624 20c66b2
Refactoring
billy1624 1ee2dab
Fixup
billy1624 8858d64
create_table_from_entity with DB backend
billy1624 f20c649
Tests all DB
billy1624 6059cdd
Remove unused EnumIter
billy1624 4b1cac7
Refactoring
billy1624 cf52839
Typo
billy1624 2ee376d
Try `EnumValue`
billy1624 db22e70
Refactoring
billy1624 ded28be
Refactoring
billy1624 fac528a
Refactoring
billy1624 a1f57ec
Merge pull request #274 from SeaQL/active-enum-3
billy1624 e04495b
Refactoring
billy1624 55de196
Add `create_enum_from_entity`
billy1624 f88c725
Fixup
billy1624 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ pub struct Model { | |
pub id: i32, | ||
pub category: Option<Category>, | ||
pub color: Option<Color>, | ||
// pub tea: Option<Tea>, | ||
pub tea: Option<Tea>, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
|
@@ -34,7 +34,10 @@ pub enum Color { | |
} | ||
|
||
#[derive(Debug, Clone, PartialEq, DeriveActiveEnum)] | ||
#[sea_orm(rs_type = "String", db_type = r#"Custom("tea".to_owned())"#)] | ||
#[sea_orm( | ||
rs_type = "String", | ||
db_type = r#"Enum("tea".to_owned(), vec!["EverydayTea".to_owned(), "BreakfastTea".to_owned()])"# | ||
)] | ||
Comment on lines
+37
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which is quite verbose when using it... |
||
pub enum Tea { | ||
#[sea_orm(string_value = "EverydayTea")] | ||
EverydayTea, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I defined the new column type Enum not only with enum name but enum variants.