drizzle_types/lib.rs
1//! Shared type definitions for Drizzle ORM
2//!
3//! This crate provides common type definitions used across multiple Drizzle crates,
4//! including:
5//!
6//! - [`Dialect`] - Database dialect enum (SQLite, PostgreSQL, MySQL)
7//! - SQLite types in the [`sqlite`] module
8//! - PostgreSQL types in the [`postgres`] module
9//!
10//! # Features
11//!
12//! - `std` - Standard library support (enabled by default)
13//! - `alloc` - Allocator support for no_std environments
14//! - `uuid` - Enable UUID type support
15//! - `serde` - Enable serde serialization/deserialization
16//! - `chrono` - Enable chrono date/time type support
17//! - `time` - Enable time crate type support
18//! - `geo-types` - Enable geometric type support
19//! - `cidr` - Enable network address type support
20//! - `bit-vec` - Enable bit vector type support
21
22#![cfg_attr(not(feature = "std"), no_std)]
23
24#[cfg(all(feature = "alloc", not(feature = "std")))]
25extern crate alloc;
26
27// Internal prelude for std/alloc compatibility
28#[allow(unused_imports)]
29pub(crate) mod alloc_prelude {
30 #[cfg(feature = "std")]
31 pub use std::{
32 borrow::Cow,
33 boxed::Box,
34 format,
35 string::{String, ToString},
36 vec,
37 vec::Vec,
38 };
39
40 #[cfg(all(feature = "alloc", not(feature = "std")))]
41 pub use alloc::{
42 borrow::Cow,
43 boxed::Box,
44 format,
45 string::{String, ToString},
46 vec,
47 vec::Vec,
48 };
49}
50
51mod dialect;
52pub mod postgres;
53pub mod serde_helpers;
54pub mod sqlite;
55
56pub use dialect::{Dialect, DialectParseError};
57
58/// Prelude module for commonly used types
59pub mod prelude {
60 pub use crate::Dialect;
61 pub use crate::postgres::{PgTypeCategory, PostgreSQLType, TypeCategory as PgRustTypeCategory};
62 pub use crate::sqlite::{SQLTypeCategory, SQLiteType, TypeCategory as SqliteRustTypeCategory};
63}