faucet_sink_mssql/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3//! # faucet-sink-mssql
4//!
5//! Microsoft SQL Server sink for the
6//! [`faucet-stream`](https://crates.io/crates/faucet-stream) ecosystem, built on
7//! [`tiberius`](https://crates.io/crates/tiberius) +
8//! [`bb8`](https://crates.io/crates/bb8).
9//!
10//! Inserts records via parameterized multi-row `INSERT` statements with
11//! auto-mapped columns or a single JSON column, mirroring `faucet-sink-postgres`
12//! / `mysql` / `sqlite`. Multi-row INSERTs auto-split to stay within MSSQL's
13//! 2100-parameter limit, batches are transaction-wrapped, and per-row failures
14//! are isolated for DLQ routing.
15//!
16//! ```no_run
17//! # use faucet_sink_mssql::{MssqlSink, MssqlSinkConfig};
18//! # async fn run() -> Result<(), faucet_core::FaucetError> {
19//! let cfg = MssqlSinkConfig::new(
20//! "mssql://sa:Str0ng%40Pass@localhost:1433/sales",
21//! "dbo.events",
22//! );
23//! let sink = MssqlSink::new(cfg).await?;
24//! # let _ = sink;
25//! # Ok(())
26//! # }
27//! ```
28
29mod coltype;
30mod config;
31mod descriptor;
32mod encode;
33mod sink;
34#[cfg(feature = "staging")]
35mod staged;
36#[cfg(feature = "staging")]
37mod staged_exec;
38mod statements;
39
40pub use config::{MssqlColumnMapping, MssqlSinkConfig, OnUnknownField};
41pub use sink::MssqlSink;
42
43// Re-export the shared connection/TLS types so users configure the sink without
44// depending on `faucet-common-mssql` directly.
45pub use descriptor::DESCRIPTOR;
46pub use faucet_common_mssql::{MssqlConnectionConfig, MssqlTls, MssqlTlsMode};