mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
style: rustfmt
This commit is contained in:
parent
d4329e98d4
commit
fedd883d91
@ -67,6 +67,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_macros)]
|
||||
macro_rules! impl_encode_for_option {
|
||||
($DB:ident) => {
|
||||
impl<'q, T> crate::encode::Encode<'q, $DB> for Option<T>
|
||||
|
||||
@ -221,7 +221,9 @@ WHERE rngtypid = $1
|
||||
.fetch_one(self)
|
||||
.await?;
|
||||
|
||||
let pg_type = PgType::try_from_oid(oid).ok_or_else(|| err_protocol!("Trying to retrieve a DB type that doesn't exist in SQLx"))?;
|
||||
let pg_type = PgType::try_from_oid(oid).ok_or_else(|| {
|
||||
err_protocol!("Trying to retrieve a DB type that doesn't exist in SQLx")
|
||||
})?;
|
||||
|
||||
Ok(PgTypeInfo(PgType::Custom(Arc::new(PgCustomType {
|
||||
kind: PgTypeKind::Range(PgTypeInfo(pg_type)),
|
||||
|
||||
@ -11,17 +11,17 @@ use core::{
|
||||
};
|
||||
|
||||
bitflags::bitflags! {
|
||||
struct RangeFlags: u8 {
|
||||
const EMPTY = 0x01;
|
||||
const LB_INC = 0x02;
|
||||
const UB_INC = 0x04;
|
||||
const LB_INF = 0x08;
|
||||
const UB_INF = 0x10;
|
||||
const LB_NULL = 0x20;
|
||||
const UB_NULL = 0x40;
|
||||
const CONTAIN_EMPTY = 0x80;
|
||||
}
|
||||
struct RangeFlags: u8 {
|
||||
const EMPTY = 0x01;
|
||||
const LB_INC = 0x02;
|
||||
const UB_INC = 0x04;
|
||||
const LB_INF = 0x08;
|
||||
const UB_INF = 0x10;
|
||||
const LB_NULL = 0x20;
|
||||
const UB_NULL = 0x40;
|
||||
const CONTAIN_EMPTY = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||
pub struct PgRange<T> {
|
||||
@ -31,10 +31,7 @@ pub struct PgRange<T> {
|
||||
|
||||
impl<T> PgRange<T> {
|
||||
pub fn new(start: Bound<T>, end: Bound<T>) -> Self {
|
||||
Self {
|
||||
start,
|
||||
end
|
||||
}
|
||||
Self { start, end }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,24 +103,24 @@ fn expand_derive_encode_weak_enum(
|
||||
let ident = &input.ident;
|
||||
|
||||
Ok(quote!(
|
||||
impl<'q, DB: sqlx::Database> sqlx::encode::Encode<'q, DB> for #ident where #repr: sqlx::encode::Encode<'q, DB> {
|
||||
fn encode(self, buf: &mut <DB as sqlx::database::HasArguments<'q>>::ArgumentBuffer) -> sqlx::encode::IsNull {
|
||||
sqlx::encode::Encode::encode((self as #repr), buf)
|
||||
impl<'q, DB: sqlx::Database> sqlx::encode::Encode<'q, DB> for #ident where #repr: sqlx::encode::Encode<'q, DB> {
|
||||
fn encode(self, buf: &mut <DB as sqlx::database::HasArguments<'q>>::ArgumentBuffer) -> sqlx::encode::IsNull {
|
||||
sqlx::encode::Encode::encode((self as #repr), buf)
|
||||
}
|
||||
|
||||
fn encode_by_ref(&self, buf: &mut <DB as sqlx::database::HasArguments<'q>>::ArgumentBuffer) -> sqlx::encode::IsNull {
|
||||
sqlx::encode::Encode::encode_by_ref(&(*self as #repr), buf)
|
||||
}
|
||||
|
||||
fn produces(&self) -> Option<DB::TypeInfo> {
|
||||
<Self as Type<MySql>>::type_info().into()
|
||||
}
|
||||
|
||||
fn encode_by_ref(&self, buf: &mut <DB as sqlx::database::HasArguments<'q>>::ArgumentBuffer) -> sqlx::encode::IsNull {
|
||||
sqlx::encode::Encode::encode_by_ref(&(*self as #repr), buf)
|
||||
fn size_hint(&self) -> usize {
|
||||
sqlx::encode::Encode::size_hint(&(*self as #repr))
|
||||
}
|
||||
|
||||
fn produces(&self) -> Option<DB::TypeInfo> {
|
||||
<Self as Type<MySql>>::type_info().into()
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> usize {
|
||||
sqlx::encode::Encode::size_hint(&(*self as #repr))
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
fn expand_derive_encode_strong_enum(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user