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.