pub struct SchemaField {
pub name: String,
pub data_type: KalamDataType,
pub index: usize,
pub flags: Option<BTreeSet<FieldFlag>>,
}Expand description
A field in the result schema returned by SQL queries
Contains all the information a client needs to properly interpret column data, including the name, data type, and index.
§Example (JSON representation)
{
"name": "user_id",
"data_type": "BigInt",
"index": 0,
"flags": ["pk", "nn", "uq"]
}§Example (with parameterized type)
{
"name": "vector",
"data_type": { "Embedding": 384 },
"index": 5
}Fields§
§name: StringColumn name
data_type: KalamDataTypeData type using KalamDB’s unified type system
index: usizeColumn position (0-indexed) in the result set
flags: Option<BTreeSet<FieldFlag>>Structured field flags (e.g. [“pk”, “nn”, “uq”]).
Omitted when there are no notable flags to reduce response size.
Implementations§
Source§impl SchemaField
impl SchemaField
Sourcepub fn new(
name: impl Into<String>,
data_type: KalamDataType,
index: usize,
) -> SchemaField
pub fn new( name: impl Into<String>, data_type: KalamDataType, index: usize, ) -> SchemaField
Create a new schema field
pub fn from_column_definition( column: &ColumnDefinition, index: usize, ) -> SchemaField
pub fn with_flags(self, flags: BTreeSet<FieldFlag>) -> SchemaField
pub fn flags_for_column( is_primary_key: bool, is_nullable: bool, ) -> Option<BTreeSet<FieldFlag>>
Trait Implementations§
Source§impl Clone for SchemaField
impl Clone for SchemaField
Source§fn clone(&self) -> SchemaField
fn clone(&self) -> SchemaField
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaField
impl Debug for SchemaField
Source§impl<'de> Deserialize<'de> for SchemaField
impl<'de> Deserialize<'de> for SchemaField
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaField, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaField, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SchemaField
Source§impl PartialEq for SchemaField
impl PartialEq for SchemaField
Source§fn eq(&self, other: &SchemaField) -> bool
fn eq(&self, other: &SchemaField) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SchemaField
impl Serialize for SchemaField
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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
impl StructuralPartialEq for SchemaField
Auto Trait Implementations§
impl Freeze for SchemaField
impl RefUnwindSafe for SchemaField
impl Send for SchemaField
impl Sync for SchemaField
impl Unpin for SchemaField
impl UnsafeUnpin for SchemaField
impl UnwindSafe for SchemaField
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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§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
Compare self to
key and return true if they are equal.