cleanup
This commit is contained in:
parent
09e86560dd
commit
d7b10f2cea
@ -836,7 +836,9 @@ pub trait ToSql: fmt::Debug {
|
|||||||
) -> Result<IsNull, Box<dyn Error + Sync + Send>>;
|
) -> Result<IsNull, Box<dyn Error + Sync + Send>>;
|
||||||
|
|
||||||
/// Specify the encode format
|
/// Specify the encode format
|
||||||
fn encode_format(&self) -> Format { Format::Binary }
|
fn encode_format(&self) -> Format {
|
||||||
|
Format::Binary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Supported Postgres message format types
|
/// Supported Postgres message format types
|
||||||
@ -849,17 +851,6 @@ pub enum Format {
|
|||||||
Binary,
|
Binary,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert from `Format` to the Postgres integer representation of those formats
|
|
||||||
impl From<Format> for i16 {
|
|
||||||
fn from(format: Format) -> Self {
|
|
||||||
match format {
|
|
||||||
Format::Text => 0,
|
|
||||||
Format::Binary => 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
impl<'a, T> ToSql for &'a T
|
impl<'a, T> ToSql for &'a T
|
||||||
where
|
where
|
||||||
T: ToSql,
|
T: ToSql,
|
||||||
|
@ -156,7 +156,10 @@ where
|
|||||||
I: IntoIterator<Item = P>,
|
I: IntoIterator<Item = P>,
|
||||||
I::IntoIter: ExactSizeIterator,
|
I::IntoIter: ExactSizeIterator,
|
||||||
{
|
{
|
||||||
let (param_formats, params):(Vec<_>, Vec<_>) = params.into_iter().map(|p|->(i16, P){(p.borrow_to_sql().encode_format().into(),p)}).unzip();
|
let (param_formats, params): (Vec<_>, Vec<_>) = params
|
||||||
|
.into_iter()
|
||||||
|
.map(|p| { (p.borrow_to_sql().encode_format() as i16, p) })
|
||||||
|
.unzip();
|
||||||
let params = params.into_iter();
|
let params = params.into_iter();
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
|
Loading…
Reference in New Issue
Block a user