Skip to main content

drizzle_types/sqlite/
mod.rs

1//! `SQLite` types.
2//!
3//! - [`types`]: zero-sized SQL type markers used for compile-time checks.
4//! - [`SQLiteType`]: column storage types as written in DDL.
5//! - [`TypeCategory`]: how a Rust field type maps to a `SQLite` column.
6//! - [`SQLTypeCategory`]: type affinity categories, used when parsing.
7//! - [`ddl`]: schema objects (tables, columns, indexes, ...) for migrations.
8
9pub mod ddl;
10mod sql_type;
11mod type_category;
12
13/// Zero-sized SQL type markers for the `SQLite` dialect.
14///
15/// Each marker stands for one storage class or affinity at compile time. The
16/// traits in [`crate::sql`] say which markers can be compared, assigned, or
17/// used in arithmetic.
18pub mod types {
19    /// `INTEGER` storage class: a 64-bit signed integer. Also used for booleans.
20    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
21    pub struct Integer;
22
23    /// `TEXT` storage class: a UTF-8 string.
24    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
25    pub struct Text;
26
27    /// `REAL` storage class: a 64-bit float.
28    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
29    pub struct Real;
30
31    /// `BLOB` storage class: raw bytes.
32    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
33    pub struct Blob;
34
35    /// `NUMERIC` affinity: stored as an integer or real when possible.
36    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
37    pub struct Numeric;
38
39    /// Untyped SQL, such as a raw `SQL` fragment. Compatible with every `SQLite` marker.
40    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
41    pub struct Any;
42}
43
44pub use sql_type::{SQLiteAffinity, SQLiteType};
45pub use type_category::{SQLTypeCategory, TypeCategory};