-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Derive value type #1720
Derive value type #1720
Conversation
Looks really good so far! |
2b69c2a
to
bd86566
Compare
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.
Seems we have 3 more debug messages to "fix"
tests/common/features/value_type.rs
Outdated
#[derive(Clone, Debug, PartialEq, Eq, DeriveValueType)] | ||
#[sea_orm(column_type = "String(Some(1))", array_type = "String")] | ||
pub struct StringVec(pub Vec<String>); |
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.
Great work. I think it looks really good. One question, is array_type
required here? What if we omit it?
Can we actually change the test case in tests/common/features/json_vec.rs
to use this DeriveValueType
instead of the manual implementation?
Just want to make sure we have had end to end tests.
tests/common/features/value_type.rs
Outdated
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub number: Integer, |
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.
The strange bit here is that the StringVec is not included in the Model for testing.
Albeit it only works on Postgres.
May be we can simply change the test case https://github.com/SeaQL/sea-orm/blob/master/tests/common/features/json_vec.rs, because now DeriveValueType
is the new, recommended API.
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.
Currently, the conversion of DeriveValueType
rely on the pre-defined conversion from the field to Value
.
I think Vec<String>
currently does not have a defined conversion to any variant of Value
, which I suppose it should.
(in json_vec, it convert itself to formatted String as Value
, which I suppose isn't a good generic approach)
I'm wondering if I should implement From<Vec<T>> for Value
or adjust the DeriveValueType
implementation only.
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.
I see. Sadly then it means that we can't 'eat our own dog food' for this test case.
So perhaps it's easier to have a separate test case to test |
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.
Perfect
examples/salvo_example/README.md
Outdated
# Poem with SeaORM example app | ||
# Salvo with SeaORM example app |
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.
laugh :P
Good eyesight!
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.
Thanks!! @darkmmon awesome work!
🎉 Released In 0.12.1 🎉Thank you everyone for the contribution! |
PR Info
New Features
Bug Fixes
Breaking Changes
Changes