mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 05:11:13 +00:00
Fix formatting (cargo fmt)
This commit is contained in:
parent
0631384f4d
commit
302db717aa
@ -42,10 +42,10 @@ mod bool;
|
||||
mod bytes;
|
||||
#[cfg(feature = "chrono")]
|
||||
mod chrono;
|
||||
#[cfg(feature = "uuid")]
|
||||
mod uuid;
|
||||
mod float;
|
||||
mod int;
|
||||
#[cfg(feature = "json")]
|
||||
mod json;
|
||||
mod str;
|
||||
#[cfg(feature = "uuid")]
|
||||
mod uuid;
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
use uuid::{adapter::Hyphenated, Uuid};
|
||||
use std::borrow::Cow;
|
||||
use crate::decode::Decode;
|
||||
use crate::encode::{Encode, IsNull};
|
||||
use crate::error::BoxDynError;
|
||||
use crate::sqlite::type_info::DataType;
|
||||
use crate::sqlite::{Sqlite, SqliteArgumentValue, SqliteTypeInfo, SqliteValueRef};
|
||||
use crate::types::Type;
|
||||
use std::borrow::Cow;
|
||||
use uuid::{adapter::Hyphenated, Uuid};
|
||||
|
||||
impl Type<Sqlite> for Uuid {
|
||||
fn type_info() -> SqliteTypeInfo {
|
||||
SqliteTypeInfo(DataType::Blob)
|
||||
}
|
||||
|
||||
|
||||
fn compatible(ty: &SqliteTypeInfo) -> bool {
|
||||
matches!(ty.0, DataType::Blob | DataType::Text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'q> Encode<'q, Sqlite> for &'q Uuid {
|
||||
@ -48,7 +48,8 @@ impl<'q> Encode<'q, Sqlite> for &'q Hyphenated {
|
||||
|
||||
impl Decode<'_, Sqlite> for Hyphenated {
|
||||
fn decode(value: SqliteValueRef<'_>) -> Result<Self, BoxDynError> {
|
||||
let uuid: Result<Uuid, BoxDynError> = Uuid::parse_str(&value.text().map(ToOwned::to_owned)?).map_err(Into::into);
|
||||
let uuid: Result<Uuid, BoxDynError> =
|
||||
Uuid::parse_str(&value.text().map(ToOwned::to_owned)?).map_err(Into::into);
|
||||
Ok(uuid?.to_hyphenated())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user