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
84
85
86
87
88
89
90
91
92
93
94
// v7.16.0 — every public item carries a doc-comment.
//! # spg-sqlx
//!
//! sqlx 0.8 Database driver for [`spg-embedded`]. Lets
//! in-process callers swap `sqlx::PgPool` for `SpgPool` and keep
//! the rest of their `sqlx::query` / `sqlx::query_as` /
//! `pool.begin` cement unchanged — backs mailrs's drop-in
//! "PgPool → SpgPool" goal from the gap evaluation (E1).
//!
//! ## v7.16.0 MVP scope
//!
//! - [`Spg`] marker type + the 11 associated types `sqlx::Database`
//! requires, all wired up to compile.
//! - [`SpgPool`] / [`SpgConnection`] wrap [`spg_embedded_tokio::AsyncDatabase`]
//! so a single in-process database is the "pool". No real
//! pooling — every "connection" handle is a cheap clone of
//! the underlying `Arc<Mutex<Database>>`.
//! - Bind-time [`Value`][SpgValue] encoding for the basic scalar
//! surface: `i32`, `i64`, `bool`, `String`, `Vec<u8>`. Round-trip
//! verified end-to-end against `sqlx::query("INSERT …").bind(…)`
//! in the test suite.
//! - Transactions via the engine's BEGIN/COMMIT/ROLLBACK; the
//! [`SpgTransactionManager`] wraps that for `pool.begin()`.
//!
//! ## v7.16.x / v7.17 follow-up
//!
//! - Encode/Decode for the remaining mailrs-side types:
//! TIMESTAMPTZ (`chrono::DateTime<Utc>`), JSON / JSONB
//! (`serde_json::Value`), `tsvector`, `VECTOR(N)`,
//! `INT[]` / `TEXT[]`, `BYTEA` (Vec<u8> beyond the basic path),
//! numeric.
//! - `FromRow` derive support — the macro's generated impl reads
//! columns by index/name via the [`Row`][sqlx_core::row::Row]
//! trait, so wiring `SpgRow::try_get` is enough for the derive
//! to "just work" once the per-type Decode lands.
//! - `sqlx::query!()` compile-time validation via sqlx's offline
//! mode (`SQLX_OFFLINE=true` + a checked-in `.sqlx/` dir). The
//! adapter itself doesn't need a DESCRIBE protocol —
//! `Spg`-shaped offline cache mirrors what mailrs ships
//! against PG today.
//!
//! ## Quick start
//!
//! ```no_run
//! use spg_sqlx::{SpgPool, SpgPoolExt};
//!
//! # async fn _f() -> Result<(), Box<dyn std::error::Error>> {
//! let pool = SpgPool::connect_in_memory().await?;
//! sqlx::query("CREATE TABLE users (id INT NOT NULL, name TEXT NOT NULL)")
//! .execute(&pool)
//! .await?;
//! sqlx::query("INSERT INTO users VALUES ($1, $2)")
//! .bind(1_i32)
//! .bind("alice")
//! .execute(&pool)
//! .await?;
//! # Ok(())
//! # }
//! ```
pub use crate;
pub use crateSpgColumn;
pub use crateSpgConnection;
pub use crateSpg;
pub use crateSpgConnectOptions;
pub use crate;
pub use crateSpgQueryResult;
pub use crateSpgRow;
pub use crateSpgStatement;
pub use crateSpgTransactionManager;
pub use crateSpgTypeInfo;
pub use crate;
// Re-export the embedded engine's owned-value type so consumers
// don't have to depend on spg-embedded directly to construct or
// pattern-match values returned from the adapter.
pub use Value as EngineValue;