sqlmodel_mysql/lib.rs
1//! MySQL driver for SQLModel Rust.
2//!
3//! `sqlmodel-mysql` is the **MySQL driver** for the SQLModel ecosystem. It
4//! implements the MySQL wire protocol from scratch using asupersync's TCP
5//! primitives and exposes a `Connection` implementation for query execution.
6//!
7//! # Role In The Architecture
8//!
9//! - Implements `sqlmodel-core::Connection` for MySQL
10//! - Provides authentication, protocol framing, and type conversions
11//! - Powers `sqlmodel-query` execution and `sqlmodel-session` persistence
12//!
13//! This crate implements the MySQL wire protocol from scratch using
14//! asupersync's TCP primitives. It provides:
15//!
16//! - Packet framing with sequence numbers
17//! - Authentication (mysql_native_password, caching_sha2_password)
18//! - Text and binary query protocols
19//! - Prepared statement support
20//! - Connection management with state machine
21//! - Type conversion between Rust and MySQL types
22//!
23//! # MySQL Protocol Overview
24//!
25//! MySQL uses a packet-based protocol with:
26//! - 3-byte payload length + 1-byte sequence number header
27//! - Packets over 16MB are split
28//! - Request/response pairing via sequence numbers
29//!
30//! # Example
31//!
32//! ```rust,ignore
33//! use sqlmodel_mysql::{MySqlConfig, MySqlConnection};
34//!
35//! let config = MySqlConfig::new()
36//! .host("localhost")
37//! .port(3306)
38//! .user("root")
39//! .database("mydb");
40//!
41//! let conn = MySqlConnection::connect(config)?;
42//! ```
43
44pub mod async_connection;
45pub mod auth;
46pub mod config;
47pub mod connection;
48pub mod protocol;
49pub mod tls;
50pub mod types;
51
52pub use async_connection::{MySqlAsyncConnection, SharedMySqlConnection};
53pub use config::{MySqlConfig, SslMode, TlsConfig};
54pub use connection::{ConnectionState, MySqlConnection};
55
56// Console integration (feature-gated)
57#[cfg(feature = "console")]
58pub use sqlmodel_console::ConsoleAware;