Skip to main content

sqlite

Function sqlite 

Source
pub const fn sqlite<const N: usize>(spec: &TableSpec<'_>) -> Sql<N>
Expand description

The SQLite insert of spec: every column the database does not fill, in TableSpec::columns order, bound as ?; DEFAULT VALUES when there is none.

§Panics

When the text outgrows N, or when the description reads the table with * (TableSpec::selecting_all). In a const the panic is a build error.

§Examples

use ruststream_sqlx_dialect::insert::{self, Sql};
use ruststream_sqlx_dialect::{Column, Form, TableSpec};

const ORDERS: TableSpec<'static> =
    TableSpec::new("order_jobs", Column::new("job_id").generated(), Form::RowLock)
        .payload(Column::new("payload"));
const INSERT: Sql<64> = insert::sqlite(&ORDERS);

assert_eq!(INSERT.as_str(), "INSERT INTO `order_jobs` (`payload`) VALUES (?)");