pub(crate) fn de_sql_value(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::SqlValue, ::aws_smithy_cbor::decode::DeserializeError> {
if depth >= 128u32 {
return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
"maximum nesting depth exceeded",
decoder.position(),
));
}
#[allow(unused_variables)]
fn pair(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::SqlValue, ::aws_smithy_cbor::decode::DeserializeError> {
Ok(match decoder.str()?.as_ref() {
"nullValue" => crate::types::SqlValue::NullValue(decoder.boolean()?),
"booleanValue" => crate::types::SqlValue::BooleanValue(decoder.boolean()?),
"longValue" => crate::types::SqlValue::LongValue(decoder.long()?),
"doubleValue" => crate::types::SqlValue::DoubleValue(decoder.double()?),
"stringValue" => crate::types::SqlValue::StringValue(decoder.string()?),
"blobValue" => crate::types::SqlValue::BlobValue(decoder.blob()?),
"jsonValue" => crate::types::SqlValue::JsonValue(decoder.string()?),
_ => {
decoder.skip()?;
crate::types::SqlValue::Unknown
}
})
}
match decoder.map()? {
None => {
let variant = pair(decoder, depth)?;
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
Ok(variant)
}
ty => Err(::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
ty,
decoder.position(),
)),
}
}
Some(1) => pair(decoder, depth),
Some(_) => Err(::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position())),
}
}