pub struct SochSchema {
pub name: String,
pub fields: Vec<SochField>,
pub primary_key: Option<String>,
pub indexes: Vec<SochIndex>,
}Expand description
A TOON schema definition
Fields§
§name: StringSchema name (table name)
fields: Vec<SochField>Field definitions
primary_key: Option<String>Primary key field name
indexes: Vec<SochIndex>Indexes on this schema
Implementations§
Source§impl SochSchema
impl SochSchema
pub fn new(name: impl Into<String>) -> Self
pub fn field(self, name: impl Into<String>, field_type: SochType) -> Self
pub fn nullable_field( self, name: impl Into<String>, field_type: SochType, ) -> Self
pub fn primary_key(self, field: impl Into<String>) -> Self
pub fn index( self, name: impl Into<String>, fields: Vec<String>, unique: bool, ) -> Self
Sourcepub fn field_names(&self) -> Vec<&str>
pub fn field_names(&self) -> Vec<&str>
Get field names for header
Sourcepub fn format_header(&self) -> String
pub fn format_header(&self) -> String
Format schema header: name[0]{field1,field2,…}:
Trait Implementations§
Source§impl Clone for SochSchema
impl Clone for SochSchema
Source§fn clone(&self) -> SochSchema
fn clone(&self) -> SochSchema
Returns a duplicate of the value. Read more
1.0.0 · 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 SochSchema
impl Debug for SochSchema
Source§impl<'de> Deserialize<'de> for SochSchema
impl<'de> Deserialize<'de> for SochSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for SochSchema
impl PartialEq for SochSchema
Source§impl Serialize for SochSchema
impl Serialize for SochSchema
impl Eq for SochSchema
impl StructuralPartialEq for SochSchema
Auto Trait Implementations§
impl Freeze for SochSchema
impl RefUnwindSafe for SochSchema
impl Send for SochSchema
impl Sync for SochSchema
impl Unpin for SochSchema
impl UnwindSafe for SochSchema
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,
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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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