welds_sqlx_mssql/
type_info.rs

1use std::fmt::{self, Display, Formatter};
2
3use crate::protocol::type_info::{DataType, TypeInfo as ProtocolTypeInfo};
4use sqlx_core::type_info::TypeInfo;
5
6#[derive(Debug, Clone, PartialEq, Eq)]
7#[cfg_attr(feature = "offline", derive(serde::Serialize, serde::Deserialize))]
8pub struct MssqlTypeInfo(pub(crate) ProtocolTypeInfo);
9
10impl TypeInfo for MssqlTypeInfo {
11    fn is_null(&self) -> bool {
12        matches!(self.0.ty, DataType::Null)
13    }
14
15    fn name(&self) -> &str {
16        self.0.name()
17    }
18}
19
20impl Display for MssqlTypeInfo {
21    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
22        f.pad(self.name())
23    }
24}