-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Separate raw value representations of postgresql and mysql backend #2134
Separate raw value representations of postgresql and mysql backend #2134
Conversation
a9ebb3a
to
870b503
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.
There are some mismatching of type and formatting issues but the implementation looks good to me
870b503
to
e6b0be8
Compare
All remaining build failures are fixed by #2131 |
e6b0be8
to
c2776c1
Compare
@sgrif Stated that he has some comments on this. |
This commit separates the raw value representation of the mysql and postgresql backend from raw `&[u8]` to specific types that could hold additional information. To avoid code duplication for commonly used types an additional trait (`BinaryRawValue`) is introduced, which is basically equivalent to `AsRef<[u8]>` but has the existing `HasRawValue` trait as super trait. This is required to workaround some higher ranked life time issues in rustc. Additionally some type information are added to the postgresql value type. Those information may allow to do dynamic type conversations in future diesel versions.
We don't look at the oid's internally and won't do that any time soon. So document that behaviour and simplify the code.
f6c9719
to
d602574
Compare
@sgrif I've done the changes we have discussed some weeks ago. |
662b13a
to
495f46e
Compare
@JohnTitor Would it possible to get a final review on this (assuming that the CI now succeeds)? |
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.
looks good to me
This was originally included in #2134 with the following comment: > Additionally some type information are added to the postgresql value > type. Those information may allow to do dynamic type conversations in > future diesel versions. While this may be useful in the future, we should wait until we have a concrete use case for doing so. At the moment this means we have to thread a `PgConnection` through various types that otherwise wouldn't need to carry it, and are stabilizing an API that we aren't even sure if/how we want to eventually use. Given that every use of `PgConnection` complicates providing an async implementation, we should be more conservative about speculative APIs like this.
This was originally included in #2134 with the following comment: > Additionally some type information are added to the postgresql value > type. Those information may allow to do dynamic type conversations in > future diesel versions. While this may be useful in the future, we should wait until we have a concrete use case for doing so. At the moment this means we have to thread a `PgConnection` through various types that otherwise wouldn't need to carry it, and are stabilizing an API that we aren't even sure if/how we want to eventually use. Given that every use of `PgConnection` complicates providing an async implementation, we should be more conservative about speculative APIs like this.
This was originally included in diesel-rs#2134 with the following comment: > Additionally some type information are added to the postgresql value > type. Those information may allow to do dynamic type conversations in > future diesel versions. While this may be useful in the future, we should wait until we have a concrete use case for doing so. At the moment this means we have to thread a `PgConnection` through various types that otherwise wouldn't need to carry it, and are stabilizing an API that we aren't even sure if/how we want to eventually use. Given that every use of `PgConnection` complicates providing an async implementation, we should be more conservative about speculative APIs like this.
This commit separates the raw value representation of the mysql and
postgresql backend from raw
&[u8]
to specific types that could holdadditional information. To avoid code duplication for commonly used
types an additional trait (
BinaryRawValue
) is introduced, which isbasically equivalent to
AsRef<[u8]>
but has the existingHasRawValue
trait as super trait. This is required to workaroundsome higher ranked life time issues in rustc.
Additionally some type information are added to the postgresql value
type. Those information may allow to do dynamic type conversations in
future diesel versions.
Basically a improved reimplementation of #1833 on top of #1976. As @sgrif stated there this PR keeps the common impl's in place by adding a
BinaryRawValue
trait.That said: I'm not super sure if the newly added public types/functions have meaningful names or if we should choose something different.
cc @pgab