Struct lumus_sql_builder::sqlite::CreateTable
source · pub struct CreateTable { /* private fields */ }
Expand description
Represents the creation of a table with specified columns and options.
Implementations§
source§impl CreateTable
impl CreateTable
sourcepub fn new<T: Into<String>>(table: T, columns: Vec<Column>) -> CreateTable
pub fn new<T: Into<String>>(table: T, columns: Vec<Column>) -> CreateTable
Creates a new CreateTable
instance with the given table name and columns.
§Example
use lumus_sql_builder::sqlite::{CreateTable, Column};
CreateTable::new("users", vec![
Column::new("name").text().not_null().primary_key(),
]);
sourcepub fn if_not_exists(self) -> Self
pub fn if_not_exists(self) -> Self
Specifies that the table should be created only if it does not already exist.
sourcepub fn build(&self) -> Result<String, SqlBuilderError>
pub fn build(&self) -> Result<String, SqlBuilderError>
Builds and returns the SQL statement for creating the table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CreateTable
impl RefUnwindSafe for CreateTable
impl Send for CreateTable
impl Sync for CreateTable
impl Unpin for CreateTable
impl UnwindSafe for CreateTable
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