Enum mz_repr::row::proto_datum::DatumType
source · pub enum DatumType {
Show 26 variants
Other(i32),
Int16(i32),
Int32(i32),
Int64(i64),
Float32(f32),
Float64(f64),
Bytes(Bytes),
String(String),
Date(ProtoDate),
Time(ProtoNaiveTime),
Timestamp(ProtoNaiveDateTime),
TimestampTz(ProtoNaiveDateTime),
Interval(ProtoInterval),
Array(ProtoArray),
List(ProtoRow),
Dict(ProtoDict),
Numeric(ProtoNumeric),
Uuid(Vec<u8>),
Uint32(u32),
Uint8(u32),
Uint16(u32),
Uint64(u64),
MzTimestamp(u64),
Range(Box<ProtoRange>),
MzAclItem(ProtoMzAclItem),
AclItem(ProtoAclItem),
}
Expand description
NB: Proto oneof ids 1..=15
get encoded in 1 byte and so we should
reserve them for the datum types we expect to be most popular.
Null, False, and True are all likely to be frequent, but the encoded length is exactly the same if they’re here or in ProtoDatumOther. In general, anything that can be encoded purely as a proto enum variant (i.e. doesn’t have a payload) is better off that way. If we run out of 1-byte encodings of ProtoDatumOther, we can always add ProtoDatumOther2.
Variants§
Other(i32)
Int16(i32)
Int32(i32)
Int64(i64)
Float32(f32)
Float64(f64)
Bytes(Bytes)
String(String)
Don’t use 9-15 without truly understanding the NB above.
Date(ProtoDate)
These get encoded with 2 bytes for the oneof id. It’s a pretty easy and low-debt migration to “bless” one of these into having a 1-byte id (fill in the new field on write, but check if either field is set on read). However, once a 1-byte id is used, it’s gone forever, so we’re conservative in handing them out.
Of these, I’d guess Timestamp and UUID are probably the first ones we’d bless followed by Date and Time.
Time(ProtoNaiveTime)
Timestamp(ProtoNaiveDateTime)
TimestampTz(ProtoNaiveDateTime)
Interval(ProtoInterval)
Array(ProtoArray)
List(ProtoRow)
Dict(ProtoDict)
Numeric(ProtoNumeric)
Uuid(Vec<u8>)
Uint32(u32)
Uint8(u32)
Uint16(u32)
Uint64(u64)
MzTimestamp(u64)
Range(Box<ProtoRange>)
MzAclItem(ProtoMzAclItem)
AclItem(ProtoAclItem)
Implementations§
source§impl DatumType
impl DatumType
sourcepub fn merge(
field: &mut Option<DatumType>,
tag: u32,
wire_type: WireType,
buf: &mut impl Buf,
ctx: DecodeContext,
) -> Result<(), DecodeError>
pub fn merge( field: &mut Option<DatumType>, tag: u32, wire_type: WireType, buf: &mut impl Buf, ctx: DecodeContext, ) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into self.
sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Trait Implementations§
impl StructuralPartialEq for DatumType
Auto Trait Implementations§
impl !Freeze for DatumType
impl RefUnwindSafe for DatumType
impl Send for DatumType
impl Sync for DatumType
impl Unpin for DatumType
impl UnwindSafe for DatumType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.