1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! SQL AST and query builder for the Turso dialect.
//!
//! This crate is the SQL layer of [turso-orm]. It owns the abstract syntax
//! tree of a statement — identifiers, values, expressions, DML and DDL
//! builders — and the single writer that renders that tree to SQL text with
//! `?` placeholders and the values to bind. It deliberately targets one
//! dialect, the SQLite grammar as implemented by Turso, which is why it stays
//! small, has no runtime dependency and binds parameters directly as Turso
//! storage-class [`Value`]s rather than through a generic value model.
//!
//! The crate does not execute anything: it never touches a connection and
//! knows nothing about rows. Executing a [`Statement`] is the job of
//! `turso-orm-driver`, and mapping entities onto statements is the job of
//! `turso-orm`.
//!
//! - [`Iden`], [`Ident`], [`TableRef`], [`ColumnRef`]: identifiers, always
//! rendered double-quoted so reserved words and mixed case are safe;
//! - [`Value`]: the five SQLite storage classes, with `From` conversions for
//! the common Rust types and, behind feature flags, `chrono`, `uuid`,
//! `serde_json` and `rust_decimal`;
//! - [`Expr`] and [`Condition`]: expressions and composable `AND` / `OR`
//! groups that parenthesise themselves so precedence is never ambiguous;
//! - [`Query`] and [`Table`]: entry points to the DML and DDL builders;
//! - [`Build`] and [`Statement`]: rendering to SQL plus bound values.
//!
//! # Example
//!
//! ```
//! use turso_sql::prelude::*;
//!
//! let (sql, values) = Query::select()
//! .column("id")
//! .column("name")
//! .from("user")
//! .and_where(Expr::col("age").gte(18))
//! .order_by("name", Order::Asc)
//! .limit(10)
//! .build();
//! assert_eq!(
//! sql,
//! r#"SELECT "id", "name" FROM "user" WHERE "age" >= ? ORDER BY "name" ASC LIMIT ?"#
//! );
//! assert_eq!(values, vec![Value::Integer(18), Value::Integer(10)]);
//! ```
//!
//! [turso-orm]: https://github.com/aartintelligent/turso-orm
pub use ;
pub use ;
pub use ;
pub use ;
pub use NAIVE_DATETIME_FORMAT;
pub use Value;
pub use ;
/// Everything needed to build queries, for a single glob import.
///
/// The prelude re-exports every builder, expression and identifier type of
/// the crate so that application code can write `use turso_sql::prelude::*;`
/// and have the whole query language in scope.