MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / try_make_long_value

Method try_make_long_value

src/avro/src/schema.rs:341–348  ·  view source on GitHub ↗

Constructs an `avro::Value` if this is of underlying long type. Guaranteed to be `Some` when `is_underlying_long` is `true`.

(&self, long: i64)

Source from the content-addressed store, hash-verified

339 /// Constructs an `avro::Value` if this is of underlying long type.
340 /// Guaranteed to be `Some` when `is_underlying_long` is `true`.
341 pub fn try_make_long_value(&self, long: i64) -> Option<Result<AvroValue, AvroError>> {
342 match self {
343 SchemaPiece::Long => Some(Ok(AvroValue::Long(long))),
344 SchemaPiece::TimestampMilli => Some(build_ts_value(long, TsUnit::Millis)),
345 SchemaPiece::TimestampMicro => Some(build_ts_value(long, TsUnit::Micros)),
346 _ => None,
347 }
348 }
349}
350
351/// Represents any valid Avro schema

Callers 2

is_underlying_longMethod · 0.80
json_to_valueMethod · 0.80

Calls 2

LongClass · 0.85
build_ts_valueFunction · 0.85

Tested by

no test coverage detected