pub enum RivetType {
Show 20 variants
Bool,
Int16,
Int32,
Int64,
UInt64,
Float32,
Float64,
Decimal {
precision: u8,
scale: i8,
},
Date,
Time {
unit: TimeUnit,
},
Timestamp {
unit: TimeUnit,
timezone: Option<String>,
},
String,
Text,
Binary,
Json,
Uuid,
Enum,
Interval,
List {
inner: Box<RivetType>,
},
Unsupported {
native_type: String,
reason: String,
},
}Expand description
Canonical Rivet type. Every source-driver column maps into exactly one
of these variants before we ever look at arrow::DataType.
Variants are kept narrow on purpose: adding a new variant is a deliberate
architectural choice (it usually means “we figured out how to safely
export a new shape of data”). Anything outside this enum becomes
RivetType::Unsupported until the type system gains first-class
support for it.
Variants§
Bool
Boolean.
Int16
Signed 16-bit integer (PostgreSQL int2, MySQL smallint).
Int32
Signed 32-bit integer (PostgreSQL int4, MySQL int).
Int64
Signed 64-bit integer (PostgreSQL int8, MySQL bigint signed).
UInt64
Unsigned 64-bit integer (MySQL bigint unsigned).
Target compatibility check required (BigQuery has no unsigned 64).
Float32
IEEE-754 32-bit float. Marked exact-ish in the roadmap mappings
because float→float is bit-exact but float→target may not round-trip.
Float64
IEEE-754 64-bit float.
Decimal
Fixed-precision decimal. Precision/scale are required — the whole
point of having a separate variant from Float64 is that we never
route money/decimal through floats. Mapped to Arrow Decimal128 when
precision <= 38, Decimal256 otherwise (roadmap §12).
Fields
Date
Calendar date (no time, no timezone).
Time
Time-of-day with the given resolution.
Timestamp
Timestamp with explicit timezone semantics. timezone: None means
“no timezone” (PostgreSQL timestamp, MySQL datetime);
timezone: Some("UTC") means timezone-normalized to UTC
(PostgreSQL timestamptz, MySQL timestamp with session tz=+00:00).
String
Variable-length string (PostgreSQL varchar, text, bpchar,
name; MySQL varchar, text).
Text
Long-form text. Currently treated identically to String on the
Arrow layer (both → Utf8), but kept as a separate variant so the
type-report can distinguish “the source declared this as text” from
“the source declared this as fixed-length char”.
Binary
Variable-length binary (PostgreSQL bytea, MySQL varbinary/blob).
Json
JSON / JSONB. Stored as Utf8 + metadata logical=json until proper
struct inference is implemented (roadmap §14).
Uuid
UUID. Stored as Utf8 + metadata logical=uuid by default; can be
switched to FixedSizeBinary(16) by policy later (roadmap §14).
Enum
Database enum type (PostgreSQL ENUM, MySQL ENUM/SET).
Stored as Utf8 + metadata logical=enum (roadmap §15).
Interval
Time interval (PostgreSQL interval).
Stored as Arrow Utf8 (ISO 8601 duration string, e.g. "P1Y2M3D").
Interval(MonthDayNano) cannot be written to Parquet, so lossless
text serialisation is used instead (roadmap §15).
List
One-dimensional array of a scalar Rivet type.
PostgreSQL int8[], text[], bool[], etc.
Stored as Arrow List(inner_type) (roadmap §15).
Unsupported
The driver knows about the type but Rivet does not have a safe
mapping for it (e.g. PostgreSQL geometry, hstore).
Carries enough context for an actionable error message in the
type-report and policy layer.
Implementations§
Source§impl RivetType
impl RivetType
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
Stable lowercase string label for persistence and human-readable
reports. Round-trippable with the JSON shape of the variant when
applicable (e.g. decimal(18,2), timestamp_tz(microsecond,UTC)).
Used by the type-report CLI (Chunk 5).
Sourcepub fn is_unsupported(&self) -> bool
pub fn is_unsupported(&self) -> bool
True for the Unsupported variant — convenience for the strict-mode
gate so callers don’t have to matches!() everywhere.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RivetType
impl<'de> Deserialize<'de> for RivetType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RivetType
impl StructuralPartialEq for RivetType
Auto Trait Implementations§
impl Freeze for RivetType
impl RefUnwindSafe for RivetType
impl Send for RivetType
impl Sync for RivetType
impl Unpin for RivetType
impl UnsafeUnpin for RivetType
impl UnwindSafe for RivetType
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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>
impl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.