Skip to main content

tdsql/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4
5#[cfg(feature = "blocking")]
6#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
7pub mod blocking;
8
9mod client;
10mod command;
11mod config;
12mod dataset;
13mod error;
14mod executor;
15mod row;
16mod stream;
17mod transaction;
18mod value;
19
20pub use client::Client;
21pub use command::{Command, CommandType, Parameter};
22pub use config::Config;
23pub use dataset::{DataSet, DataTable};
24pub use error::{Error, Result, StatementKind};
25pub use executor::Executor;
26pub use row::{Column, Row, RowIndex};
27pub use stream::RowStream;
28pub use transaction::{IsolationLevel, Transaction};
29pub use value::{DataValue, FromSql, SqlType, ToSql};
30
31// The crates whose types appear in this crate's public API are re-exported, so
32// callers can reach them at a version that is guaranteed to match. Binding a
33// `chrono::DateTime` or a `uuid::Uuid` only type-checks against the exact
34// version `tdsql` was built with; a second copy in the dependency graph
35// produces the notoriously opaque "expected `Uuid`, found `Uuid`" error.
36//
37// This follows Effective Rust item 24 ("re-export dependencies whose types
38// appear in your API") and matches `sqlx::types`. The trade-off is real and
39// deliberate: it couples `tdsql`'s major version to these three, so a breaking
40// release of any of them forces one here. All three are mature and moving
41// slowly, which is what makes that price acceptable.
42
43/// The `chrono` version this crate binds against -- `tdsql::chrono::Utc`.
44///
45/// Its types appear in the public API as [`DataValue::Date`],
46/// [`DataValue::Time`], [`DataValue::DateTime`] and
47/// [`DataValue::DateTimeOffset`].
48pub use chrono;
49
50/// The `rust_decimal` version this crate binds against.
51///
52/// Its [`Decimal`](rust_decimal::Decimal) is the public API's
53/// [`DataValue::Decimal`].
54pub use rust_decimal;
55
56/// The `uuid` version this crate binds against -- `tdsql::uuid::Uuid`.
57///
58/// Its [`Uuid`](uuid::Uuid) is the public API's [`DataValue::Guid`], which is
59/// how SQL Server's `uniqueidentifier` is read and bound.
60pub use uuid;