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
implement jsonb concat operator #3035
implement jsonb concat operator #3035
Conversation
czotomo
mentioned this pull request
|
@weiznich am I supposed to push all the changes generated by compiletests locally even if Cargo.lock now contains bumped version of mysqlclient-sys? |
Looks good from my side with those small suggestions fixed
About the compile tests: Yes those need an update too, as some error messages change due to the fact that there are now additional trait impls that rustc could suggest. You can do that by running TRYBUILD=overwrite cargo test in the compile tests directory and commit the changes afterwards. I will add that to the general instructions, as this may happen for other operators as well.
| /// let santas_address: serde_json::Value = serde_json::from_str(r#"{ | ||
| /// "street": "Article Circle Expressway 1", | ||
| /// "city": "North Pole", | ||
| /// "postcode": "99705", | ||
| /// "state": "Alaska" | ||
| /// }"#).unwrap(); |
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.
Could we use the serde_json::json! macro here? That should make it much easier to read the code + remove the .unwrap()
(Same for the other json strings)
| T::SqlType: JsonB, | ||
| { | ||
| } | ||
| #[doc(hidden)] | ||
| /// Marker trait used to implement `PgJsonbExpressionMethods` on the appropriate types. | ||
| pub trait JsonB {} | ||
|
|
||
| impl JsonB for Jsonb {} |
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.
We should allow nullable jsonb values here too. That's possible by the following change:
| T::SqlType: JsonB, | |
| { | |
| } | |
| #[doc(hidden)] | |
| /// Marker trait used to implement `PgJsonbExpressionMethods` on the appropriate types. | |
| pub trait JsonB {} | |
| impl JsonB for Jsonb {} | |
| T::SqlType: JsonbOrNullableJsonb, | |
| { | |
| } | |
| #[doc(hidden)] | |
| /// Marker trait used to implement `PgJsonbExpressionMethods` on the appropriate types. | |
| pub trait JsonbOrNullableJsonb {} | |
| impl JsonbOrNullableJsonb for Jsonb {} | |
| impl JsonbOrNullableJsonb for Nullable<Jsonb> {} |
|
Thanks for your contribution |
czotomo
mentioned this pull request


No description provided.