mssql_types/
lib.rs

1//! # mssql-types
2//!
3//! SQL Server to Rust type mappings and conversions.
4//!
5//! This crate provides bidirectional mapping between SQL Server data types
6//! and Rust types, handling the encoding and decoding of values in TDS format.
7//!
8//! ## Features
9//!
10//! - `chrono` (default): Enable date/time type support via chrono
11//! - `uuid` (default): Enable UUID type support
12//! - `decimal` (default): Enable decimal type support via rust_decimal
13//! - `json`: Enable JSON type support via serde_json
14//!
15//! ## Type Mappings
16//!
17//! | SQL Server Type | Rust Type |
18//! |-----------------|-----------|
19//! | `BIT` | `bool` |
20//! | `TINYINT` | `u8` |
21//! | `SMALLINT` | `i16` |
22//! | `INT` | `i32` |
23//! | `BIGINT` | `i64` |
24//! | `REAL` | `f32` |
25//! | `FLOAT` | `f64` |
26//! | `DECIMAL`/`NUMERIC` | `rust_decimal::Decimal` |
27//! | `CHAR`/`VARCHAR` | `String` |
28//! | `NCHAR`/`NVARCHAR` | `String` |
29//! | `DATE` | `chrono::NaiveDate` |
30//! | `TIME` | `chrono::NaiveTime` |
31//! | `DATETIME2` | `chrono::NaiveDateTime` |
32//! | `UNIQUEIDENTIFIER` | `uuid::Uuid` |
33
34#![warn(missing_docs)]
35#![deny(unsafe_code)]
36
37pub mod decode;
38pub mod encode;
39pub mod error;
40pub mod from_sql;
41pub mod to_sql;
42pub mod value;
43
44pub use decode::{Collation, TdsDecode, TypeInfo, decode_utf16_string, decode_value};
45pub use encode::{TdsEncode, encode_utf16_string};
46pub use error::TypeError;
47pub use from_sql::FromSql;
48pub use to_sql::ToSql;
49pub use value::SqlValue;