Skip to main content

SpannerTableBuilder

Struct SpannerTableBuilder 

Source
pub struct SpannerTableBuilder { /* private fields */ }
Expand description

Builder for CREATE TABLE statements in Spanner DDL format

Implementations§

Source§

impl SpannerTableBuilder

Source

pub fn new() -> Self

Create a new table builder

Source

pub fn table<S: Into<String>>(self, name: S) -> Self

Set the table name

Source

pub fn col<S: Into<String>>( self, name: S, col_type: &ColumnType, not_null: bool, ) -> Self

Add a column with a SeaQuery ColumnType

Source

pub fn col_raw<S: Into<String>, T: Into<String>>( self, name: S, spanner_type: T, not_null: bool, ) -> Self

Add a column with a raw Spanner type string

Source

pub fn string<S: Into<String>>( self, name: S, max_len: Option<u32>, not_null: bool, ) -> Self

Add a STRING column

Source

pub fn int64<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add an INT64 column

Source

pub fn float64<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a FLOAT64 column

Source

pub fn bool<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a BOOL column

Source

pub fn bytes<S: Into<String>>( self, name: S, max_len: Option<u32>, not_null: bool, ) -> Self

Add a BYTES column

Source

pub fn date<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a DATE column

Source

pub fn timestamp<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a TIMESTAMP column

Source

pub fn json<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a JSON column

Source

pub fn numeric<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a NUMERIC column

Source

pub fn uuid<S: Into<String>>(self, name: S, not_null: bool) -> Self

Add a UUID column

Source

pub fn col_with_default<S: Into<String>, T: Into<String>, D: Into<String>>( self, name: S, spanner_type: T, not_null: bool, default_expr: D, ) -> Self

Add a column with DEFAULT expression

Source

pub fn col_generated<S: Into<String>, T: Into<String>, E: Into<String>>( self, name: S, spanner_type: T, expr: E, stored: bool, ) -> Self

Add a generated column

Source

pub fn primary_key<I, S>(self, columns: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Set primary key columns

Source

pub fn interleave_in_parent<S: Into<String>>(self, parent_table: S) -> Self

Set INTERLEAVE IN PARENT clause

Source

pub fn on_delete_cascade(self) -> Self

Set ON DELETE CASCADE for interleaved table

Source

pub fn row_deletion_policy<S: Into<String>>(self, column: S, days: u32) -> Self

Set row deletion policy (TTL)

Source

pub fn build(self) -> String

Build the CREATE TABLE DDL statement

Trait Implementations§

Source§

impl Clone for SpannerTableBuilder

Source§

fn clone(&self) -> SpannerTableBuilder

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 SpannerTableBuilder

Source§

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

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

impl Default for SpannerTableBuilder

Source§

fn default() -> SpannerTableBuilder

Returns the “default value” for a type. 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.