-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: add options "create-str" and "update-str" #83
Conversation
Looks good to me @hasezoey, could I request that we simplify the tests by only including a string field for the Todo model and nothing else? If you think it provides value, I'm okay with it 🙌 ! |
sure, i basically just always copy |
3f1c51d
to
9fa54f7
Compare
Update:
|
Can you give an example here? We don't want to remove Currently, you can update the fields you're interested in and set Here's an example: Imagine we had this table: diesel::table! {
todos (id) {
text -> Text,
text_nullable -> Nullable<Text>,
}
} Here's what pub struct UpdateTodo {
pub text: Option<String>,
pub text_nullable: Option<Option<String>>,
} And here are some example queries:
|
thanks for pointing this out, i will fix it. the problem i fixed with that was that please clarify on what function example of fixing the current state: (context this line) -let field_type = if f.is_optional {
+let mut field_type = if f.is_optional {
format!("Option<{}>", base_type)
} else {
base_type.into()
};
+if self.ty == StructType::Update {
+ field_type = format!("Option<{}>", field_type);
+} but then we would also need to remove the following lines: Lines 199 to 206 in 9fa54f7
because otherwise (as mentioned earlier) or do know a better solution? i will make a separate PR (and let this PR depend on it) to try to refactor how those functions work |
…nsibility and improving documentation re Wulf#83 (comment)
…nsibility and improving documentation re Wulf#83 (comment)
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.
@hasezoey looks good to me :-)
🙌
This PR adds options
create-str
andupdate-str
to set which string type to use, this can be useful over justString
, because those structs may not need to own their values, but the normal (StructType::Read
) will still need to own it valuesre #56