- Notifications
You must be signed in to change notification settings - Fork516
Add to_sql for bytes Cow as well#1051
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
postgres-types/src/lib.rs Outdated
impl<'a>ToSqlforCow<'a,[u8]>{ | ||
fnto_sql(&self,ty:&Type,w:&mutBytesMut) ->Result<IsNull,Box<dynError +Sync +Send>>{ | ||
<&strasToSql>::to_sql(&self.as_ref(), ty, w) |
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.
str -> [u8]
, and you shouldn't need the.as_ref()
.
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.
Ah yeah, sorry, was just testing it locally. I'll fix that now!
andrewbaxterJul 20, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Withoutas_ref
I get
error[E0308]: mismatched types --> postgres-types/src/lib.rs:1040:34 |1040 | <&[u8] as ToSql>::to_sql(&self, ty, w) | ------------------------ ^^^^^ expected `&&[u8]`, found `&&Cow<'_, [u8]>` | | | arguments to this function are incorrect | = note: expected reference `&&[u8]` found reference `&&Cow<'a, [u8]>`note: method defined here --> postgres-types/src/lib.rs:851:8 |851 | fn to_sql(&self, ty: &Type, out: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> | ^^^^^^
andrewbaxterJul 20, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Thestr
thing was fixed, I think this is ready to go. And thanks for the fast review!
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.
Oh yeah, you'd need to do the same&&**self
dance you can see above. This works as well though.
Thanks! |
No description provided.