pub struct StructDataType {
pub fields: Vec<StructField>,
}Expand description
Struct/record type: an ordered list of named fields.
Supported natively by BigQuery (STRUCT), Databricks (STRUCT),
ClickHouse (named Tuple) and DuckDB (STRUCT). Engines without a
record type render their JSON type instead; the field names and types are
still part of the declared type, they are simply not restated in the DDL.
Field order is significant: it is the order the design declared, it is the order every engine with a record type writes, and two structs holding the same fields in a different order are different types.
§Example
use razeri_plugin_contract::{DataType, data_type::{StructDataType, StructField}};
let address = StructDataType::new(vec![
StructField::new("street", DataType::varchar(200)),
StructField::new("zip", DataType::varchar(10)),
]);
assert_eq!(address.fields.len(), 2);
assert_eq!(address.fields[0].name, "street");Fields§
§fields: Vec<StructField>The struct’s fields, in declaration order.
Implementations§
Source§impl StructDataType
impl StructDataType
Sourcepub fn new(fields: Vec<StructField>) -> Self
pub fn new(fields: Vec<StructField>) -> Self
Creates a struct type from an ordered list of named fields.
§Example
use razeri_plugin_contract::{DataType, data_type::{StructDataType, StructField}};
let point = StructDataType::new(vec![
StructField::new("x", DataType::int()),
StructField::new("y", DataType::int()),
]);
assert_eq!(point.fields[1].name, "y");Trait Implementations§
Source§impl Clone for StructDataType
impl Clone for StructDataType
Source§fn clone(&self) -> StructDataType
fn clone(&self) -> StructDataType
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 StructDataType
impl Debug for StructDataType
impl Eq for StructDataType
Source§impl PartialEq for StructDataType
impl PartialEq for StructDataType
impl StructuralPartialEq for StructDataType
Auto Trait Implementations§
impl Freeze for StructDataType
impl RefUnwindSafe for StructDataType
impl Send for StructDataType
impl Sync for StructDataType
impl Unpin for StructDataType
impl UnsafeUnpin for StructDataType
impl UnwindSafe for StructDataType
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