Skip to main content

ColumnType

Enum ColumnType 

Source
#[non_exhaustive]
pub enum ColumnType {
Show 20 variants Int64, Float64, String, Bool, Bytes, Timestamp, Timestamptz, SystemTimestamp, Decimal { precision: u8, scale: u8, }, Geometry, Vector(u32), Uuid, Json, Ulid, Duration, Array, Set, Regex, Range, Record,
}
Expand description

Typed column definition for strict document and columnar collections.

#[non_exhaustive] — this enum grows with each type system expansion (e.g. future variants may add Decimal { precision, scale } or split Timestamp/TimestampTz). External exhaustive match arms must handle future variants via a typed error arm rather than _ => unreachable!().

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Int64

§

Float64

§

String

§

Bool

§

Bytes

§

Timestamp

Naive (no-timezone) timestamp with microsecond precision. OID 1114.

§

Timestamptz

UTC (timezone-aware) timestamp with microsecond precision. OID 1184.

§

SystemTimestamp

System-assigned timestamp (bitemporal system_from_ms). Same 8-byte layout as Timestamp, but tagged distinctly so the planner and DDL layer can reject user-supplied values — the column is populated by the engine from HLC at commit.

§

Decimal

Arbitrary-precision decimal with explicit precision and scale.

precision: total significant digits, 1–38. scale: digits after the decimal point, 0–precision. Default when unspecified: {38, 10}.

Fields

§precision: u8
§scale: u8
§

Geometry

§

Vector(u32)

Fixed-dimension float32 vector.

§

Uuid

§

Json

Arbitrary nested data stored as inline MessagePack. Variable-length. Accepts any Value type.

§

Ulid

ULID: 16-byte Crockford Base32-encoded sortable ID.

§

Duration

Duration: signed microsecond precision (i64 internally).

§

Array

Ordered array of values. Variable-length, inline MessagePack.

§

Set

Ordered set (auto-deduplicated). Variable-length, inline MessagePack.

§

Regex

Compiled regex pattern. Stored as string internally.

§

Range

Bounded range of values. Variable-length, inline MessagePack.

§

Record

Typed reference to another record (table:id). Variable-length, inline MessagePack.

Implementations§

Source§

impl ColumnType

Source

pub fn fixed_size(&self) -> Option<usize>

Whether this type has a fixed byte size in Binary Tuple layout.

Source

pub fn is_variable_length(&self) -> bool

Whether this type is variable-length (requires offset table entry).

Source

pub fn to_pg_oid(&self) -> u32

Return the canonical PostgreSQL type OID for this column type.

This is the single authoritative mapping between NodeDB ColumnType variants and PostgreSQL wire-protocol OIDs. All pgwire code must derive OIDs from this method — no local string-matching tables.

Choices for non-native types:

  • Geometry25 (TEXT): no standard pg geometry OID; PostGIS uses its own extension OID which we cannot claim. TEXT lets clients at least see the WKT/WKB string.
  • Vector(_)1021 (FLOAT4_ARRAY): closest built-in pg type for a fixed-dimension float32 vector; pgvector uses a custom OID, which we avoid to stay dependency-free.
  • Array, Set, Range, Record, Regex114 (JSON): these are variable-length MessagePack-encoded structures; JSON is the safest generic text OID for clients that need to read the value as a string.
Source

pub fn accepts(&self, value: &Value) -> bool

Whether a Value is compatible with this column type.

Accepts both native Value types (e.g., Value::DateTime for Timestamp) AND coercion sources from SQL input (e.g., Value::String for Timestamp). Null is accepted for any type — nullability is enforced at schema level.

Trait Implementations§

Source§

impl Clone for ColumnType

Source§

fn clone(&self) -> ColumnType

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 ColumnType

Source§

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

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

impl<'de> Deserialize<'de> for ColumnType

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 Display for ColumnType

Source§

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

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

impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for ColumnType

Source§

fn read<R: Read<'__msgpack_de>>(reader: &mut R) -> Result<Self, Error>
where Self: Sized,

Reads the MessagePack representation of this value from the provided reader.
Source§

impl FromStr for ColumnType

Source§

type Err = ColumnTypeParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for ColumnType

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 ColumnType

Source§

fn eq(&self, other: &ColumnType) -> 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 ColumnType

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 ToMessagePack for ColumnType

Source§

fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Writes the MessagePack representation of this value into the provided writer.
Source§

impl Copy for ColumnType

Source§

impl Eq for ColumnType

Source§

impl StructuralPartialEq for ColumnType

Auto Trait Implementations§

Blanket Implementations§

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<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<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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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
Source§

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

Source§

impl<T> FromMessagePackOwned for T
where T: for<'a> FromMessagePack<'a>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,