sql-middleware 0.6.0

Lightweight async wrappers for tokio-postgres, rusqlite, turso, and tiberius.
Documentation
[package]
name = "sql-middleware"
version = "0.6.0"
edition = "2024"
authors = ["Derek Frye <derek.frye@gmail.com>"]
license = "MIT"
description = "Lightweight async wrappers for tokio-postgres, rusqlite, turso, and tiberius."
repository = "https://github.com/derekfrye/sql-middleware"
readme = "docs/README.md"
homepage = "https://github.com/derekfrye/sql-middleware"
keywords = ["sql", "sqlite", "postgresql", "turso", "mssql"]
documentation = "https://docs.rs/sql-middleware"

[workspace]
members = ["simulator"]
resolver = "3"

[lints.rust]
unsafe_code = "deny"

[features]
default = ["postgres", "sqlite"]
sqlite = ["dep:rusqlite", "dep:bb8"]
postgres = ["dep:tokio-postgres", "dep:bb8"]
typed-postgres = ["postgres"] # compatibility alias; typed API is always on when postgres is enabled
mssql = ["dep:tiberius", "dep:futures-util", "dep:bb8-tiberius"]
turso = ["dep:turso", "dep:bb8"]
typed-turso = ["turso"] # compatibility alias; typed API is always on when turso is enabled
benchmarks = ["dep:criterion", "dep:rand", "dep:rand_chacha"]

[dependencies]
# checked Sept 2025
# `cargo stale`
tokio = { version = "1", features = ["full"] }  
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio-postgres = { version = "0", features = ["with-chrono-0_4", "with-serde_json-1"], optional = true }
chrono = {version = "0", features = ["serde"] }
regex = "1"
clap = { version = "4", features = ["derive"] }

thiserror = "2"
async-trait = "0"
# SQL Server dependencies
tiberius = { version = "0", features = ["chrono", "sql-browser-tokio"], optional = true }
deadpool = "0"
bb8-tiberius = { version = "0", optional = true }
futures-util = { version = "0", optional = true }
lazy_static = "1"
parking_lot = "0"
crossbeam-channel = "0"
# Benchmark dependencies
criterion = { version = "0", features = ["async_tokio"], optional = true }
rand = { version = ">=0.9.2", optional = true }
rand_chacha = { version = ">=0.9.0", optional = true }
# turso deps
turso = { version = "0.4", optional = true }
bb8 = { version = "0", optional = true }
rusqlite = { version = "0", optional = true }
tracing = "0"

[package.metadata.docs.rs]
rustdoc-args = ["--deny", "unsafe_code"]


[dependencies.tokio-util]
version = "0"
features = ["full"]

[dev-dependencies]
criterion = { version = "0", features = ["async_tokio"] }
rand = ">=0.9.2"
rand_chacha = ">=0.9.0"
sql-middleware = { path = ".", default-features = false, features = ["benchmarks", "mssql", "postgres", "turso", "sqlite"] }
tempfile = "3"

[[bench]]
name = "database_benchmark"
harness = false

[[bench]]
name = "bench_rusqlite_single_row_lookup"
harness = false

[[bench]]
name = "bench_rusqlite_multithread_pool_checkout"
harness = false

[[bench]]
name = "bench_turso_single_row_lookup"
harness = false
required-features = ["turso"]

[profile.bench]
debug = true
opt-level = 0