Skip to main content

DataType

Enum DataType 

Source
#[repr(u8)]
pub enum DataType {
Show 55 variants Unknown = 0, Integer = 1, UnsignedInteger = 2, Float = 3, Text = 4, Blob = 5, Boolean = 6, Timestamp = 7, Duration = 8, IpAddr = 9, MacAddr = 10, Vector = 11, Nullable = 12, Json = 13, Uuid = 14, NodeRef = 15, EdgeRef = 16, VectorRef = 17, RowRef = 18, Color = 19, Email = 20, Url = 21, Phone = 22, Semver = 23, Cidr = 24, Date = 25, Time = 26, Decimal = 27, Enum = 28, Array = 29, TimestampMs = 30, Ipv4 = 31, Ipv6 = 32, Subnet = 33, Port = 34, Latitude = 35, Longitude = 36, GeoPoint = 37, Country2 = 38, Country3 = 39, Lang2 = 40, Lang5 = 41, Currency = 42, ColorAlpha = 43, BigInt = 44, KeyRef = 45, DocRef = 46, TableRef = 47, PageRef = 48, Secret = 49, Password = 50, TextZstd = 51, BlobZstd = 52, AssetCode = 53, Money = 54,
}
Expand description

Type identifier for column definitions

Variants§

§

Unknown = 0

Polymorphic / “any” placeholder. Used by function-catalog signatures (e.g. JSON_SET(json, path, value) where value accepts any scalar) so the resolver can skip concrete type checking for that argument. Never appears in stored schemas.

§

Integer = 1

Signed 64-bit integer

§

UnsignedInteger = 2

Unsigned 64-bit integer

§

Float = 3

64-bit floating point

§

Text = 4

Variable-length UTF-8 text

§

Blob = 5

Variable-length binary data

§

Boolean = 6

Boolean (true/false)

§

Timestamp = 7

Unix timestamp (seconds since epoch)

§

Duration = 8

Duration in milliseconds

§

IpAddr = 9

IPv4 or IPv6 address

§

MacAddr = 10

MAC address (6 bytes)

§

Vector = 11

Fixed-dimension float vector (for similarity search)

§

Nullable = 12

Nullable wrapper (stores inner type in high nibble)

§

Json = 13

JSON-like structured data

§

Uuid = 14

UUID (16 bytes)

§

NodeRef = 15

Reference to a graph node (for unified queries)

§

EdgeRef = 16

Reference to a graph edge

§

VectorRef = 17

Reference to a vector in vector store

§

RowRef = 18

Reference to a table row (table_id, row_id)

§

Color = 19

RGB color (3 bytes)

§

Email = 20

Email address (validated, stored lowercase)

§

Url = 21

URL (validated)

§

Phone = 22

Phone number (stored as u64 digits)

§

Semver = 23

Semantic version (packed u32: major1M + minor1K + patch)

§

Cidr = 24

CIDR notation (IPv4 u32 + prefix u8 = 5 bytes)

§

Date = 25

Date only (i32 days since Unix epoch, no time)

§

Time = 26

Time only (u32 milliseconds since midnight)

§

Decimal = 27

Fixed-point decimal (i64 with configurable precision)

§

Enum = 28

Enumerated type (u8 index into variant list)

§

Array = 29

Array of values (homogeneous)

§

TimestampMs = 30

Timestamp with millisecond precision (i64 ms since epoch)

§

Ipv4 = 31

IPv4 address (u32)

§

Ipv6 = 32

IPv6 address ([u8; 16])

§

Subnet = 33

Network subnet (ip u32 + mask u32)

§

Port = 34

TCP/UDP port number (u16)

§

Latitude = 35

Geographic latitude (i32 microdegrees)

§

Longitude = 36

Geographic longitude (i32 microdegrees)

§

GeoPoint = 37

Geographic point (lat i32 + lon i32)

§

Country2 = 38

ISO 3166-1 alpha-2 country code ([u8; 2])

§

Country3 = 39

ISO 3166-1 alpha-3 country code ([u8; 3])

§

Lang2 = 40

ISO 639-1 language code ([u8; 2])

§

Lang5 = 41

IETF language tag, e.g. “pt-BR” ([u8; 5])

§

Currency = 42

ISO 4217 currency code ([u8; 3])

§

ColorAlpha = 43

RGBA color with alpha ([u8; 4])

§

BigInt = 44

Signed 64-bit integer (alias for large numbers)

§

KeyRef = 45

Reference to a KV pair (collection, key string)

§

DocRef = 46

Reference to a document (collection, entity_id)

§

TableRef = 47

Reference to a table/collection by name

§

PageRef = 48

Reference to a physical storage page

§

Secret = 49

Encrypted secret (AES-256-GCM ciphertext, keyed by vault AES key)

§

Password = 50

Argon2id password hash

§

TextZstd = 51

C3 TOAST: zstd-compressed UTF-8 text (> TOAST_THRESHOLD bytes). In-memory representation is always Value::Text — compression is transparent to all callers above the serialization layer.

§

BlobZstd = 52

C3 TOAST: zstd-compressed binary blob (> TOAST_THRESHOLD bytes). In-memory representation is always Value::Blob.

§

AssetCode = 53

General asset code (fiat or crypto), validated and normalized uppercase text

§

Money = 54

Monetary amount represented as minor units + scale + asset code

Implementations§

Source§

impl DataType

Source

pub fn category(&self) -> TypeCategory

Return the coercion category this type belongs to. Used by the Fase 3 operator / function resolver to group candidate types when picking an overload.

Source

pub fn is_preferred(&self) -> bool

Is this type the preferred representative of its category? When the Fase 3 resolver has two equally-good candidates after exact-match counting, it picks the preferred one. Preferences are:

  • Numeric: Float (highest precision, captures all integer values lossily for arithmetic purposes)
  • String: Text
  • DateTime: TimestampMs (milli precision beats second)
  • Network: IpAddr (superset of Ipv4/Ipv6)
  • Domain / Reference / Opaque / others: no preferred member (categories where every type is equally “native” so a tie means the user must be explicit).
Source§

impl DataType

Source

pub fn to_byte(&self) -> u8

Serialize type to byte

Source

pub fn from_byte(b: u8) -> Option<DataType>

Deserialize type from byte

Source

pub fn from_sql_name(name: &str) -> Option<DataType>

Resolve a DataType from an SQL-level type name (case-insensitive). Accepts short SQL aliases (INT → Integer, STRING → Text) plus the canonical reddb names rendered by Display. Returns None for unknown / unsupported names so callers can surface a parse error.

Source

pub fn from_sql_type_name(sql_type: &SqlTypeName) -> Option<DataType>

Resolve a DataType from a parsed SQL type name.

Source

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

Returns the fixed size in bytes if known, None for variable-length types

Source

pub fn is_indexable(&self) -> bool

Check if this type supports indexing

Source

pub fn is_orderable(&self) -> bool

Check if this type supports ordering

Trait Implementations§

Source§

impl Clone for DataType

Source§

fn clone(&self) -> DataType

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 Copy for DataType

Source§

impl Debug for DataType

Source§

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

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

impl Display for DataType

Source§

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

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

impl Eq for DataType

Source§

impl Hash for DataType

Source§

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

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 DataType

Source§

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

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> 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