macro_rules! ascii_byte_type {
($typ: ident, $size: expr, $comment: expr) => {
#[doc = $comment]
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq, Hash)]
#[serde(transparent)]
pub struct $typ([u8; $size]);
impl FromStr for $typ {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
if !s.is_ascii() {
anyhow::bail!("{} should be {} bytes of ASCII chars", stringify!($typ), $size);
}
Ok(match s.len() {
$size => Self(s.as_bytes().try_into()?),
v => anyhow::bail!("{} can't be ascid due to length: {v}", stringify!($typ)),
})
}
}
};
}
ascii_byte_type!(SomeStruct, 24);
bad response: Code: 386. DB::Exception: There is no supertype for types FixedString(24), Tuple(UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) because some of them are Tuple and some of them are not: while executing 'FUNCTION equals(id : 0, (49, 48, 48, 49, 102, 49, 50, 49, 97, 53, 48, 49, 52, 55, 100, 48, 48, 48, 48, 51, 49, 56, 52, 51) : 3) -> equals(id, (49, 48, 48, 49, 102, 49, 50, 49, 97, 53, 48, 49, 52, 55, 100, 48, 48, 48, 48, 51, 49, 56, 52, 51)) UInt8 : 5'. (NO_COMMON_TYPE) (version 23.9.1.1095 (official build))
Is there any way to fix or request a feature for that? Cause negative trait impls are still not there and with unstable anyways there is no way to do negative on positive
I'm facing an issue that
FixedString(N)type for insertion and selection is requiring[u8; n]which is obviously good.But as
clickhouse::sql::Bindhas blanket implementation onimpl<S: serde::Serialize>it is binding it asBytesas well ( obviously ),but itself clickhouse doesn't support that comparison.
So for type:
I'm getting error:
Is there any way to fix or request a feature for that? Cause negative trait impls are still not there and with unstable anyways there is no way to do negative on positive