Expand description
(De)serialize Option<BigDecimal> as a Schema::Union(Schema::Null, Schema::BigDecimal) instead of a Schema::Union(Schema::Null, Schema::String).
This module is intended to be used through the Serde with attribute.
Use apache_avro::serde::bigdecimal for non-optional big decimals values.
When used with different serialization formats, this will write bytes.
See usage with below example:
#[derive(AvroSchema, Serialize, Deserialize)]
struct StructWithBigDecimal {
#[avro(with)]
#[serde(with = "apache_avro::serde::bigdecimal_opt")]
decimal: Option<BigDecimal>,
}Functionsยง
- deserialize
- get_
record_ fields_ in_ ctxt - Returns
None - get_
schema_ in_ ctxt - Returns
Schema::Union(Schema::Null, Schema::BigDecimal) - serialize