Skip to main content

KalamDataType

Enum KalamDataType 

Source
pub enum KalamDataType {
Show 17 variants Boolean, Int, BigInt, Double, Float, Text, Timestamp, Date, DateTime, Time, Json, Bytes, Embedding(usize), Uuid, Decimal { precision: u8, scale: u8, }, SmallInt, File,
}
Expand description

Unified data type enum with wire format tags

Each variant has an associated tag byte for wire format serialization:

  • BOOLEAN = 0x01
  • INT = 0x02 (32-bit signed integer)
  • BIGINT = 0x03 (64-bit signed integer)
  • DOUBLE = 0x04 (64-bit floating point)
  • FLOAT = 0x05 (32-bit floating point)
  • TEXT = 0x06 (UTF-8 string)
  • TIMESTAMP = 0x07 (microseconds since epoch)
  • DATE = 0x08 (days since epoch)
  • DATETIME = 0x09 (datetime with timezone)
  • TIME = 0x0A (time of day)
  • JSON = 0x0B (JSON document)
  • BYTES = 0x0C (binary data)
  • EMBEDDING = 0x0D (fixed-size float32 vector with dimension parameter)
  • UUID = 0x0E (128-bit universally unique identifier)
  • DECIMAL = 0x0F (fixed-point decimal with precision and scale)
  • SMALLINT = 0x10 (16-bit signed integer)
  • FILE = 0x11 (file reference - stored as JSON FileRef object)

Variants§

§

Boolean

Boolean type (0x01)

§

Int

32-bit signed integer (0x02)

§

BigInt

64-bit signed integer (0x03)

§

Double

64-bit floating point (0x04)

§

Float

32-bit floating point (0x05)

§

Text

UTF-8 string (0x06)

§

Timestamp

Timestamp with microsecond precision (0x07)

§

Date

Date (days since epoch) (0x08)

§

DateTime

DateTime with timezone (0x09)

§

Time

Time of day (0x0A)

§

Json

JSON document (0x0B)

§

Bytes

Binary data (0x0C)

§

Embedding(usize)

Fixed-size float32 vector for embeddings (0x0D) Parameter: dimension (1 ≤ dim ≤ 8192)

§

Uuid

UUID (128-bit universally unique identifier) (0x0E) Stored as 16 bytes in standard RFC 4122 format

§

Decimal

Fixed-point decimal (0x0F) Parameters: precision (total digits 1-38), scale (decimal places 0-precision) Example: DECIMAL(10, 2) can store values like 12345678.90

Fields

§precision: u8
§scale: u8
§

SmallInt

16-bit signed integer (0x10) Range: -32,768 to 32,767

§

File

File reference (0x11) Stored as a JSON FileRef object containing file metadata (id, subfolder, name, size, mime, sha256)

Implementations§

Source§

impl KalamDataType

Source

pub fn tag(&self) -> u8

Get the wire format tag byte for this type

Source

pub fn from_tag(tag: u8) -> Result<KalamDataType, String>

Create a KalamDataType from a wire format tag

Source

pub fn validate_embedding_dimension(dim: usize) -> Result<(), String>

Validate EMBEDDING dimension is within allowed range

Source

pub fn validate_decimal_params(precision: u8, scale: u8) -> Result<(), String>

Validate DECIMAL precision and scale

Source

pub fn sql_name(&self) -> String

Get the SQL type name for display

Trait Implementations§

Source§

impl Clone for KalamDataType

Source§

fn clone(&self) -> KalamDataType

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 KalamDataType

Source§

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

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

impl<'de> Deserialize<'de> for KalamDataType

Source§

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

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

impl Display for KalamDataType

Source§

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

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

impl Eq for KalamDataType

Source§

impl Hash for KalamDataType

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 KalamDataType

Source§

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

Source§

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

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

impl StructuralPartialEq for KalamDataType

Source§

impl WireFormat for KalamDataType

Source§

fn encode<W>(&self, writer: &mut W) -> Result<(), WireFormatError>
where W: Write,

Encode this type to wire format
Source§

fn decode<R>(reader: &mut R) -> Result<KalamDataType, WireFormatError>
where R: Read,

Decode this type from wire format
Source§

fn encoded_size(&self) -> usize

Estimate encoded size in bytes

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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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