Skip to main content

sqlw_backend/
lib.rs

1#![warn(missing_docs)]
2
3//! Database executor implementations for sqlw.
4//!
5//! Provides async database connections with a unified interface.
6//!
7//! # Features
8//!
9//! - `sqlite` - Rusqlite support via `tokio-rusqlite`
10//! - `turso` - Turso/libSQL support (default)
11//! - `postgres` - PostgreSQL support via `bb8` connection pool with `tokio-postgres`
12//! - `mysql` - MySQL support via `mysql_async`
13//!
14//! # Module Layout
15//!
16//! Each backend module is self-contained:
17//! - `postgres` contains both `PostgresExecutor` and `PostgresRowRef`
18//! - `mysql` contains both `MySqlExecutor` and `MySqlRowRef`
19//! - `sqlite` contains both `SqliteExecutor` and `SqliteRowRef`
20//! - `turso` contains both `TursoExecutor` and `TursoRowRef`
21//!
22//! # Example
23//!
24//! ```ignore
25//! use sqlw::{QueryExecutor, query_qmark as query};
26//! use sqlw_backend::turso::TursoExecutor;
27//!
28//! let executor = TursoExecutor::new(|| async {
29//!     turso::Builder::new_local("file.db").build().await?
30//!         .connect()
31//! }).await?;
32//!
33//! let users: Vec<User> = executor.query_list(query).await?;
34//! ```
35
36#[cfg(feature = "sqlite")]
37pub mod sqlite;
38
39#[cfg(feature = "turso")]
40pub mod turso;
41
42#[cfg(feature = "postgres")]
43pub mod postgres;
44
45#[cfg(feature = "mysql")]
46pub mod mysql;
47
48pub mod error;