sqlx_sqlite/
type_checking.rs

1#[allow(unused_imports)]
2use sqlx_core as sqlx;
3
4use crate::Sqlite;
5
6// f32 is not included below as REAL represents a floating point value
7// stored as an 8-byte IEEE floating point number (i.e. an f64)
8// For more info see: https://www.sqlite.org/datatype3.html#storage_classes_and_datatypes
9impl_type_checking!(
10    Sqlite {
11        // Note that since the macro checks `column_type_info == <T>::type_info()` first,
12        // we can list `bool` without it being automatically picked for all integer types
13        // due to its `TypeInfo::compatible()` impl.
14        bool,
15        // Since it returns `DataType::Int4` for `type_info()`,
16        // `i32` should only be chosen IFF the column decltype is `INT4`
17        i32,
18        i64,
19        f64,
20        String,
21        Vec<u8>,
22
23        #[cfg(all(feature = "chrono", not(feature = "time")))]
24        sqlx::types::chrono::NaiveDate,
25
26        #[cfg(all(feature = "chrono", not(feature = "time")))]
27        sqlx::types::chrono::NaiveDateTime,
28
29        #[cfg(all(feature = "chrono", not(feature = "time")))]
30        sqlx::types::chrono::DateTime<sqlx::types::chrono::Utc> | sqlx::types::chrono::DateTime<_>,
31
32        #[cfg(feature = "time")]
33        sqlx::types::time::OffsetDateTime,
34
35        #[cfg(feature = "time")]
36        sqlx::types::time::PrimitiveDateTime,
37
38        #[cfg(feature = "time")]
39        sqlx::types::time::Date,
40
41        #[cfg(feature = "uuid")]
42        sqlx::types::Uuid,
43    },
44    ParamChecking::Weak,
45    // While there are type integrations that must be enabled via Cargo feature,
46    // SQLite's type system doesn't actually have any type that we cannot decode by default.
47    //
48    // The type integrations simply allow the user to skip some intermediate representation,
49    // which is usually TEXT.
50    feature-types: _info => None,
51);