narwhal_drivers/lib.rs
1//! Bundled database drivers for narwhal.
2//!
3//! Each engine (`postgres`, `mysql`, `sqlite`, `duckdb`, `clickhouse`,
4//! `mssql`) lives behind a cargo feature of the same name. Enabling the
5//! `all-drivers` umbrella turns them all on; the `narwhaldb` binary
6//! relies on this. Library consumers pick what they need:
7//!
8//! ```toml
9//! narwhal-drivers = { version = "1", default-features = false, features = ["postgres", "sqlite"] }
10//! ```
11//!
12//! The crate also re-exports [`registry::DriverRegistry`] as
13//! [`DriverRegistry`], which replaces the v1.x `narwhal-driver-registry`
14//! crate.
15
16#![forbid(unsafe_code)]
17
18#[cfg(feature = "clickhouse")]
19pub mod clickhouse;
20#[cfg(feature = "duckdb")]
21pub mod duckdb;
22#[cfg(feature = "mssql")]
23pub mod mssql;
24#[cfg(feature = "mysql")]
25pub mod mysql;
26#[cfg(feature = "postgres")]
27pub mod postgres;
28#[cfg(feature = "sqlite")]
29pub mod sqlite;
30
31pub mod registry;
32
33pub use registry::DriverRegistry;
34
35/// Convenience constructor for a registry preloaded with every driver
36/// compiled into this build. Equivalent to
37/// [`DriverRegistry::with_defaults`]; kept as a free function so the
38/// historical `narwhal_drivers::Registry::new()` call shape
39/// has a minimally-disruptive migration target.
40#[must_use]
41pub fn registry() -> DriverRegistry {
42 DriverRegistry::with_defaults()
43}