drizzle_sqlite/
lib.rs

1//! SQLite implementation for Drizzle
2//!
3//! This crate provides SQLite-specific types, query builders, and utilities.
4
5// Public modules
6pub mod attrs;
7pub mod builder;
8pub mod common;
9pub mod conditions;
10pub mod connection;
11pub mod expression;
12pub mod helpers;
13pub mod pragma;
14pub mod traits;
15pub mod values;
16
17// Re-export key types at crate root
18pub use builder::QueryBuilder;
19pub use common::SQLiteSchemaType;
20pub use connection::{ConnectionRef, SQLiteTransactionType};
21pub use traits::{
22    DrizzleRow, FromSQLiteValue, SQLiteColumn, SQLiteColumnInfo, SQLiteTable, SQLiteTableInfo,
23};
24pub use values::{OwnedSQLiteValue, SQLiteInsertValue, SQLiteValue, ValueWrapper};
25
26// Re-export ParamBind for use in params! macro
27pub use drizzle_core::ParamBind;
28
29/// Creates an array of SQL parameters for binding values to placeholders.
30///
31/// # Syntax
32/// - `{ name: value }` - Colon parameter (creates :name placeholder)
33///
34/// # Examples
35///
36/// ```
37/// use drizzle_sqlite::params;
38///
39/// let params = params![{ name: "alice" }, { active: true }];
40/// ```
41#[macro_export]
42macro_rules! params {
43    // Multiple parameters - creates a fixed-size array of Param structs
44    [$($param:tt),+ $(,)?] => {
45        [
46            $(
47                $crate::params_internal!($param)
48            ),+
49        ]
50    };
51}
52
53/// Internal helper macro for params! - converts individual items to Param structs
54#[macro_export]
55macro_rules! params_internal {
56    // Colon-style named parameter
57    ({ $key:ident: $value:expr }) => {
58        $crate::ParamBind::named(stringify!($key), $crate::SQLiteValue::from($value))
59    };
60    // Positional parameter
61    ($value:expr) => {
62        $crate::ParamBind::positional($crate::SQLiteValue::from($value))
63    };
64}
65
66// Re-export type alias from traits
67pub use traits::SQLiteSQL;