Skip to main content

RivetType

Enum RivetType 

Source
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

§precision: u8

Total number of significant digits.

§scale: i8

Digits to the right of the decimal point. Signed because PostgreSQL numeric allows negative scale.

§

Date

Calendar date (no time, no timezone).

§

Time

Time-of-day with the given resolution.

Fields

§

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).

Fields

§timezone: Option<String>
§

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).

Fields

§

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.

Fields

§native_type: String
§reason: String

Implementations§

Source§

impl RivetType

Source

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).

Source

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 Clone for RivetType

Source§

fn clone(&self) -> RivetType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RivetType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RivetType

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for RivetType

Source§

impl Hash for RivetType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RivetType

Source§

fn eq(&self, other: &RivetType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RivetType

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RivetType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more