|
1 |
| -//! Conversions between Rust and **MySQL** types. |
| 1 | +//! Conversions between Rust and **MySQL/MariaDB** types. |
2 | 2 | //!
|
3 | 3 | //! # Types
|
4 | 4 | //!
|
5 |
| -//! | Rust type | MySQL type(s) | |
| 5 | +//! | Rust type | MySQL/MariaDB type(s) | |
6 | 6 | //! |---------------------------------------|------------------------------------------------------|
|
7 | 7 | //! | `bool` | TINYINT(1), BOOLEAN, BOOL (see below) |
|
8 | 8 | //! | `i8` | TINYINT |
|
|
17 | 17 | //! | `f64` | DOUBLE |
|
18 | 18 | //! | `&str`, [`String`] | VARCHAR, CHAR, TEXT |
|
19 | 19 | //! | `&[u8]`, `Vec<u8>` | VARBINARY, BINARY, BLOB |
|
20 |
| -//! | `IpAddr`, `Ipv4Addr`, `Ipv6Addr` | VARCHAR, TEXT | |
| 20 | +//! | `IpAddr` | VARCHAR, TEXT | |
| 21 | +//! | `Ipv4Addr` | INET4 (MariaDB-only), VARCHAR, TEXT | |
| 22 | +//! | `Ipv6Addr` | INET6 (MariaDB-only), VARCHAR, TEXT | |
21 | 23 | //!
|
22 | 24 | //! ##### Note: `BOOLEAN`/`BOOL` Type
|
23 | 25 | //! MySQL and MariaDB treat `BOOLEAN` as an alias of the `TINYINT` type:
|
|
40 | 42 | //!
|
41 | 43 | //! Requires the `chrono` Cargo feature flag.
|
42 | 44 | //!
|
43 |
| -//! | Rust type | MySQL type(s) | |
| 45 | +//! | Rust type | MySQL/MariaDB type(s) | |
44 | 46 | //! |---------------------------------------|------------------------------------------------------|
|
45 | 47 | //! | `chrono::DateTime<Utc>` | TIMESTAMP |
|
46 | 48 | //! | `chrono::DateTime<Local>` | TIMESTAMP |
|
|
52 | 54 | //!
|
53 | 55 | //! Requires the `time` Cargo feature flag.
|
54 | 56 | //!
|
55 |
| -//! | Rust type | MySQL type(s) | |
| 57 | +//! | Rust type | MySQL/MariaDB type(s) | |
56 | 58 | //! |---------------------------------------|------------------------------------------------------|
|
57 | 59 | //! | `time::PrimitiveDateTime` | DATETIME |
|
58 | 60 | //! | `time::OffsetDateTime` | TIMESTAMP |
|
|
62 | 64 | //! ### [`bigdecimal`](https://crates.io/crates/bigdecimal)
|
63 | 65 | //! Requires the `bigdecimal` Cargo feature flag.
|
64 | 66 | //!
|
65 |
| -//! | Rust type | MySQL type(s) | |
| 67 | +//! | Rust type | MySQL/MariaDB type(s) | |
66 | 68 | //! |---------------------------------------|------------------------------------------------------|
|
67 | 69 | //! | `bigdecimal::BigDecimal` | DECIMAL |
|
68 | 70 | //!
|
69 | 71 | //! ### [`decimal`](https://crates.io/crates/rust_decimal)
|
70 | 72 | //! Requires the `decimal` Cargo feature flag.
|
71 | 73 | //!
|
72 |
| -//! | Rust type | MySQL type(s) | |
| 74 | +//! | Rust type | MySQL/MariaDB type(s) | |
73 | 75 | //! |---------------------------------------|------------------------------------------------------|
|
74 | 76 | //! | `rust_decimal::Decimal` | DECIMAL |
|
75 | 77 | //!
|
76 | 78 | //! ### [`uuid`](https://crates.io/crates/uuid)
|
77 | 79 | //!
|
78 | 80 | //! Requires the `uuid` Cargo feature flag.
|
79 | 81 | //!
|
80 |
| -//! | Rust type | MySQL type(s) | |
| 82 | +//! | Rust type | MySQL/MariaDB type(s) | |
81 | 83 | //! |---------------------------------------|------------------------------------------------------|
|
82 | 84 | //! | `uuid::Uuid` | BINARY(16), VARCHAR, CHAR, TEXT |
|
83 |
| -//! | `uuid::fmt::Hyphenated` | CHAR(36) | |
| 85 | +//! | `uuid::fmt::Hyphenated` | CHAR(36), UUID (MariaDB-only) | |
84 | 86 | //! | `uuid::fmt::Simple` | CHAR(32) |
|
85 | 87 | //!
|
86 | 88 | //! ### [`json`](https://crates.io/crates/serde_json)
|
87 | 89 | //!
|
88 | 90 | //! Requires the `json` Cargo feature flag.
|
89 | 91 | //!
|
90 |
| -//! | Rust type | MySQL type(s) | |
| 92 | +//! | Rust type | MySQL/MariaDB type(s) | |
91 | 93 | //! |---------------------------------------|------------------------------------------------------|
|
92 | 94 | //! | [`Json<T>`] | JSON |
|
93 | 95 | //! | `serde_json::JsonValue` | JSON |
|
|
96 | 98 | //! # Nullable
|
97 | 99 | //!
|
98 | 100 | //! In addition, `Option<T>` is supported where `T` implements `Type`. An `Option<T>` represents
|
99 |
| -//! a potentially `NULL` value from MySQL. |
| 101 | +//! a potentially `NULL` value from MySQL/MariaDB. |
100 | 102 |
|
101 | 103 | pub(crate) use sqlx_core::types::*;
|
102 | 104 |
|
|
0 commit comments