sqlx_mysql/
type_checking.rs

1// Type mappings used by the macros and `Debug` impls.
2
3#[allow(unused_imports)]
4use sqlx_core as sqlx;
5
6use crate::MySql;
7
8impl_type_checking!(
9    MySql {
10        u8,
11        u16,
12        u32,
13        u64,
14        i8,
15        i16,
16        i32,
17        i64,
18        f32,
19        f64,
20
21        // ordering is important here as otherwise we might infer strings to be binary
22        // CHAR, VAR_CHAR, TEXT
23        String,
24
25        // BINARY, VAR_BINARY, BLOB
26        Vec<u8>,
27
28        #[cfg(feature = "json")]
29        sqlx::types::JsonValue,
30    },
31    ParamChecking::Weak,
32    feature-types: info => info.__type_feature_gate(),
33    // The expansion of the macro automatically applies the correct feature name
34    // and checks `[macros.preferred-crates]`
35    datetime-types: {
36        chrono: {
37            sqlx::types::chrono::NaiveTime,
38
39            sqlx::types::chrono::NaiveDate,
40
41            sqlx::types::chrono::NaiveDateTime,
42
43            sqlx::types::chrono::DateTime<sqlx::types::chrono::Utc>,
44        },
45        time: {
46            sqlx::types::time::Time,
47
48            sqlx::types::time::Date,
49
50            sqlx::types::time::PrimitiveDateTime,
51
52            sqlx::types::time::OffsetDateTime,
53        },
54    },
55    numeric-types: {
56        bigdecimal: {
57            sqlx::types::BigDecimal,
58        },
59        rust_decimal: {
60            sqlx::types::Decimal,
61        },
62    },
63);