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
//! SQL database implementations for the Evento event sourcing library.
//!
//! This crate provides SQL-based persistence for events and subscriber state, supporting
//! SQLite, MySQL, and PostgreSQL through feature flags.
//!
//! # Features
//!
//! - **`sqlite`** - Enables SQLite database support
//! - **`mysql`** - Enables MySQL database support
//! - **`postgres`** - Enables PostgreSQL database support
//!
//! All features are enabled by default. You can selectively enable only the databases you need:
//!
//! ```toml
//! [dependencies]
//! evento-sql = { version = "1.8", default-features = false, features = ["postgres"] }
//! ```
//!
//! # Usage
//!
//! The main type is [`Sql<DB>`], a generic wrapper around a SQLx connection pool that
//! implements the [`Executor`](evento_core::Executor) trait for event sourcing operations.
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use evento_sql::Sql;
//! use sqlx::sqlite::SqlitePoolOptions;
//!
//! // Create a connection pool
//! let pool = SqlitePoolOptions::new()
//! .connect(":memory:")
//! .await?;
//!
//! // Wrap it in the Sql executor
//! let executor: Sql<sqlx::Sqlite> = pool.into();
//!
//! // Use with Evento for event sourcing operations
//! ```
//!
//! ## Type Aliases
//!
//! Convenience type aliases are provided for each database:
//!
//! - [`Sqlite`] - `Sql<sqlx::Sqlite>`
//! - [`MySql`] - `Sql<sqlx::MySql>`
//! - [`Postgres`] - `Sql<sqlx::Postgres>`
//!
//! Read-write pair types for CQRS patterns:
//!
//! - [`RwSqlite`] - Read/write SQLite executor pair
//! - [`RwMySql`] - Read/write MySQL executor pair
//! - [`RwPostgres`] - Read/write PostgreSQL executor pair
//!
//! # Core Components
//!
//! - [`Sql`] - The main executor type wrapping a SQLx connection pool
//! - [`Reader`] - Query builder for reading events with cursor-based pagination
//! - [`Bind`] - Trait for cursor serialization in paginated queries
//! - [`Event`], [`Subscriber`], [`Snapshot`] - Sea-Query column identifiers
//!
//! # Serialization
//!
//! The [`sql_types`] module provides the [`Bitcode`](sql_types::Bitcode) wrapper for compact
//! binary serialization of event data using the bitcode format.
pub use *;