Skip to main content

Sqlite

Struct Sqlite 

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

The SQLite schema: backtick quoting, INTEGER PRIMARY KEY AUTOINCREMENT inline, TEXT for most types, DELETE FROM for truncation.

use utopia_query::schema::{Schema, Sqlite};

let mut table = Sqlite::new().table("notes");
table.id("id");
table.text("body");
assert_eq!(
    table.create()?.query,
    "CREATE TABLE `notes` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `body` TEXT NOT NULL)"
);
use Utopia\Query\Schema\SQLite;

$table = (new SQLite())->table('notes');
$table->id();
$table->text('body');
echo $table->create()->query, "\n";

PHP: Utopia\Query\Schema\SQLite.

Implementations§

Source§

impl Sqlite

Source

pub fn new() -> Self

A SQLite schema without an executor.

PHP: new SQLite().

Trait Implementations§

Source§

impl AutoIncrement for Sqlite

Source§

impl Checks for Sqlite

Source§

impl Clone for Sqlite

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Collation for Sqlite

Source§

impl ColumnAlterations for Sqlite

Source§

impl Comment for Sqlite

Source§

impl CompositePrimary for Sqlite

Source§

impl Debug for Sqlite

Source§

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

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

impl Default for Sqlite

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Generated for Sqlite

Source§

impl InlineForeignKey for Sqlite

Source§

impl Schema for Sqlite

Source§

fn compile_column_definition(&self, column: &Column<Self>) -> Result<String>

An auto-incrementing primary key is INTEGER PRIMARY KEY AUTOINCREMENT inline; other columns compile as usual.

Source§

fn compile_create( &self, table: &Table<Self>, if_not_exists: bool, ) -> Result<Statement>

Without the trailing PRIMARY KEY (...) clause when a column carries its key inline.

Source§

fn executor(&self) -> Option<&Executor>

The executor statements carry, if any.
Source§

fn set_executor(&mut self, executor: Executor) -> &mut Self

Sets the executor every statement compiled from now on carries (Statement::execute runs it). Read more
Source§

fn literal(&self) -> StringLiteral

How the dialect writes a string literal: comments, defaults and enum values are inlined, since DDL takes no bound parameters. Read more
Source§

fn quote(&self, identifier: &str) -> Result<String>

Quotes a possibly qualified identifier. Read more
Source§

fn quote_literal(&self, identifier: &str) -> Result<String>

Quotes one identifier, dots included. Read more
Source§

fn compile_column_type(&self, column: &Column<Self>) -> Result<String>

The SQL type of column. Read more
Source§

fn compile_auto_increment(&self) -> &'static str

The auto-increment keyword. Read more
Source§

fn compile_unsigned(&self) -> &'static str

The unsigned keyword, or empty where there is none. Read more
Source§

fn compile_rename(&self, from: &str, to: &str) -> Result<Statement>

Renames table from to to. Read more
Source§

fn compile_truncate(&self, name: &str) -> Result<Statement>

Empties table name. Read more
Source§

fn drop_index(&self, _table: &str, name: &str) -> Result<Statement>

Drops index name of table. Read more
Source§

fn table(&self, name: impl Into<String>) -> Table<Self>

A blueprint of table name compiled by this schema. Read more
Source§

fn compile_alter(&self, table: &Table<Self>) -> Result<Statement>

ALTER TABLE for table. Read more
Source§

fn compile_drop(&self, name: &str, if_exists: bool) -> Result<Statement>

DROP TABLE [IF EXISTS] name. Read more
Source§

fn create_index( &self, table: &str, name: &str, columns: &[&str], options: &IndexOptions, ) -> Result<Statement>

CREATE INDEX name ON table (columns) with options. Read more
Source§

fn compile_generated_clause(&self, column: &Column<Self>) -> String

GENERATED ALWAYS AS (...) STORED|VIRTUAL. Read more
Source§

fn compile_create_suffix(&self, _table: &Table<Self>) -> String

Clauses after the column list of CREATE TABLE (partitioning). Read more
Source§

fn quote_collation(&self, collation: &str) -> Result<String>

A collation name as COLLATE takes it. Read more
Source§

fn compile_index_columns(&self, index: &Index) -> Result<String>

The column list of an index: lengths, collations, operator class, orders and raw expressions. Read more
Source§

impl Serial for Sqlite

Source§

impl Unique for Sqlite

Source§

impl Views for Sqlite

Source§

fn create_view( &self, name: &str, query: &mut dyn AnyBuilder, ) -> Result<Statement>

Creates view name of the query query builds (its bindings ride along). Read more
Source§

fn drop_view(&self, name: &str) -> Result<Statement>

Drops view name. Read more
Source§

impl VirtualGenerated for Sqlite

Auto Trait Implementations§

§

impl !RefUnwindSafe for Sqlite

§

impl !UnwindSafe for Sqlite

§

impl Forget for Sqlite

§

impl Freeze for Sqlite
where *const ArcInner<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send> is !null: Freeze, PhantomData<ArcInner<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send>>: Freeze,

§

impl Move for Sqlite

§

impl Send for Sqlite
where Arc<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send>: Send,

§

impl Sync for Sqlite
where Arc<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send>: Sync,

§

impl Unpin for Sqlite
where Arc<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send>: Unpin,

§

impl UnsafeUnpin for Sqlite
where *const ArcInner<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Fn(&Statement) -> Result<Value<Object>, Error> + Sync + Send>>: UnsafeUnpin,

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.