Skip to main content

Schema

Struct Schema 

Source
pub struct Schema { /* private fields */ }

Implementations§

Source§

impl Schema

Source

pub fn new() -> Self

Source

pub fn create_table( &mut self, name: String, columns: Vec<Column>, ) -> Result<TableId>

Source

pub fn create_table_with_roots( &mut self, name: String, columns: Vec<Column>, table_root_page_id: u32, primary_key_root_page_id: u32, ) -> Result<TableId>

Source

pub fn get_table(&self, table_id: TableId) -> Option<&Table>

Source

pub fn get_table_by_name(&self, name: &str) -> Option<&Table>

Source

pub fn view(&self, name: &str) -> Option<&View>

Source

pub fn trigger(&self, name: &str) -> Option<&Trigger>

Source

pub fn create_view(&mut self, view: View) -> Result<()>

Source

pub fn drop_view(&mut self, name: &str) -> Result<View>

Source

pub fn create_trigger(&mut self, trigger: Trigger) -> Result<()>

Source

pub fn drop_trigger(&mut self, name: &str) -> Result<Trigger>

Source

pub fn drop_table(&mut self, table_id: TableId) -> Result<()>

Source

pub fn rename_table( &mut self, table_id: TableId, new_name: String, ) -> Result<()>

Source

pub fn add_secondary_index( &mut self, table_id: TableId, index: SecondaryIndex, ) -> Result<()>

Source

pub fn add_column(&mut self, table_id: TableId, column: Column) -> Result<()>

Source

pub fn rename_column( &mut self, table_id: TableId, old_name: &str, new_name: String, ) -> Result<()>

Source

pub fn drop_column( &mut self, table_id: TableId, column_name: &str, ) -> Result<usize>

Source

pub fn set_column_default( &mut self, table_id: TableId, column_name: &str, default_value: Option<Value>, ) -> Result<()>

Source

pub fn set_column_nullable( &mut self, table_id: TableId, column_name: &str, nullable: bool, ) -> Result<()>

Source

pub fn add_check_constraint( &mut self, table_id: TableId, constraint: CheckConstraint, ) -> Result<()>

Source

pub fn add_foreign_key( &mut self, table_id: TableId, constraint: ForeignKeyConstraint, ) -> Result<()>

Source

pub fn drop_secondary_index( &mut self, table_id: TableId, index_name: &str, ) -> Result<()>

Source

pub fn drop_named_constraint( &mut self, table_id: TableId, constraint_name: &str, ) -> Result<NamedConstraintKind>

Source

pub fn set_table_primary_key_root_page( &mut self, table_id: TableId, root_page_id: u32, ) -> Result<()>

Source

pub fn set_table_storage_roots( &mut self, table_id: TableId, table_root_page_id: u32, primary_key_root_page_id: u32, ) -> Result<()>

Source

pub fn list_tables(&self) -> Vec<(TableId, String)>

Source

pub fn list_views(&self) -> Vec<String>

Source

pub fn list_triggers(&self) -> Vec<String>

Source

pub fn get_table_count(&self) -> usize

Source

pub fn get_total_column_count(&self) -> usize

Source

pub fn next_table_id(&self) -> u32

Source

pub fn next_column_id(&self) -> u32

Source

pub fn validate(&self) -> Result<()>

Source

pub fn serialize(&self, buffer: &mut Vec<u8>) -> Result<()>

Source

pub fn deserialize(buffer: &[u8]) -> Result<Self>

Source

pub fn set_table_root_page( &mut self, table_id: TableId, root_page_id: u32, ) -> Result<()>

Source

pub fn insert_table(&mut self, table: Table) -> Result<()>

Insert a fully-defined table (used when loading persisted schema).

Source

pub fn insert_view(&mut self, view: View) -> Result<()>

Source

pub fn insert_trigger(&mut self, trigger: Trigger) -> Result<()>

Trait Implementations§

Source§

impl Clone for Schema

Source§

fn clone(&self) -> Schema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Schema

Source§

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

Formats the value using the given formatter. Read more

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