mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
fix: rename Decode::accepts to Type::compatible for MSSQL / bool
This commit is contained in:
parent
9abdd7e408
commit
ec6b4be7fb
@ -9,6 +9,10 @@ impl Type<Mssql> for bool {
|
||||
fn type_info() -> MssqlTypeInfo {
|
||||
MssqlTypeInfo(TypeInfo::new(DataType::BitN, 1))
|
||||
}
|
||||
|
||||
fn compatible(ty: &MssqlTypeInfo) -> bool {
|
||||
matches!(ty.0.ty, DataType::Bit | DataType::BitN)
|
||||
}
|
||||
}
|
||||
|
||||
impl Encode<'_, Mssql> for bool {
|
||||
@ -20,10 +24,6 @@ impl Encode<'_, Mssql> for bool {
|
||||
}
|
||||
|
||||
impl Decode<'_, Mssql> for bool {
|
||||
fn accepts(ty: &MssqlTypeInfo) -> bool {
|
||||
matches!(ty.0.ty, DataType::Bit | DataType::BitN)
|
||||
}
|
||||
|
||||
fn decode(value: MssqlValueRef<'_>) -> Result<Self, BoxDynError> {
|
||||
Ok(value.as_bytes()?[0] == 1)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user