cdbc_mysql/types/mod.rs
1//! Conversions between Rust and **MySQL** types.
2//!
3//! # Types
4//!
5//! | Rust type | MySQL type(s) |
6//! |---------------------------------------|------------------------------------------------------|
7//! | `bool` | TINYINT(1), BOOLEAN |
8//! | `i8` | TINYINT |
9//! | `i16` | SMALLINT |
10//! | `i32` | INT |
11//! | `i64` | BIGINT |
12//! | `u8` | TINYINT UNSIGNED |
13//! | `u16` | SMALLINT UNSIGNED |
14//! | `u32` | INT UNSIGNED |
15//! | `u64` | BIGINT UNSIGNED |
16//! | `f32` | FLOAT |
17//! | `f64` | DOUBLE |
18//! | `&str`, [`String`] | VARCHAR, CHAR, TEXT |
19//! | `&[u8]`, `Vec<u8>` | VARBINARY, BINARY, BLOB |
20//!
21//! ### [`chrono`](https://crates.io/crates/chrono)
22//!
23//! Requires the `chrono` Cargo feature flag.
24//!
25//! | Rust type | MySQL type(s) |
26//! |---------------------------------------|------------------------------------------------------|
27//! | `chrono::DateTime<Utc>` | TIMESTAMP |
28//! | `chrono::DateTime<Local>` | TIMESTAMP |
29//! | `chrono::NaiveDateTime` | DATETIME |
30//! | `chrono::NaiveDate` | DATE |
31//! | `chrono::NaiveTime` | TIME |
32//!
33//! ### [`time`](https://crates.io/crates/time)
34//!
35//! Requires the `time` Cargo feature flag.
36//!
37//! | Rust type | MySQL type(s) |
38//! |---------------------------------------|------------------------------------------------------|
39//! | `time::PrimitiveDateTime` | DATETIME |
40//! | `time::OffsetDateTime` | TIMESTAMP |
41//! | `time::Date` | DATE |
42//! | `time::Time` | TIME |
43//!
44//! ### [`bigdecimal`](https://crates.io/crates/bigdecimal)
45//! Requires the `bigdecimal` Cargo feature flag.
46//!
47//! | Rust type | MySQL type(s) |
48//! |---------------------------------------|------------------------------------------------------|
49//! | `bigdecimal::BigDecimal` | DECIMAL |
50//!
51//! ### [`decimal`](https://crates.io/crates/rust_decimal)
52//! Requires the `decimal` Cargo feature flag.
53//!
54//! | Rust type | MySQL type(s) |
55//! |---------------------------------------|------------------------------------------------------|
56//! | `rust_decimal::Decimal` | DECIMAL |
57//!
58//! ### [`uuid`](https://crates.io/crates/uuid)
59//!
60//! Requires the `uuid` Cargo feature flag.
61//!
62//! | Rust type | MySQL type(s) |
63//! |---------------------------------------|------------------------------------------------------|
64//! | `uuid::Uuid` | BYTE(16), VARCHAR, CHAR, TEXT |
65//! | `uuid::adapter::Hyphenated` | CHAR(36) |
66//!
67//! ### [`json`](https://crates.io/crates/json)
68//!
69//! Requires the `json` Cargo feature flag.
70//!
71//! | Rust type | MySQL type(s) |
72//! |---------------------------------------|------------------------------------------------------|
73//! | `json::JsonValue` | JSON
74//!
75//! # Nullable
76//!
77//! In addition, `Option<T>` is supported where `T` implements `Type`. An `Option<T>` represents
78//! a potentially `NULL` value from MySQL.
79//!
80
81mod bool;
82mod bytes;
83mod float;
84mod int;
85mod str;
86mod uint;
87
88#[cfg(feature = "bigdecimal")]
89mod bigdecimal;
90
91#[cfg(feature = "decimal")]
92mod decimal;
93
94#[cfg(feature = "chrono")]
95mod chrono;
96
97#[cfg(feature = "time")]
98mod time;
99
100#[cfg(feature = "uuid")]
101mod uuid;
102
103#[cfg(feature = "json")]
104mod json;