Skip to main content

fraiseql_db/types/
mod.rs

1//! Type definitions for fraiseql-db.
2
3pub mod db_types;
4pub mod query_stats;
5pub mod sql_hints;
6
7// Re-export db types so `crate::types::DatabaseType` etc. still work
8#[cfg(feature = "postgres")]
9pub use db_types::QueryParam;
10#[cfg(feature = "postgres")]
11pub use db_types::as_sql_param_refs;
12pub use db_types::{DatabaseType, JsonbValue, PoolMetrics};
13// Re-export query stats types
14pub use query_stats::QueryStatEntry;
15// Re-export sql hint types
16pub use sql_hints::{OrderByClause, OrderDirection, SqlProjectionHint};
17
18use crate::dialect::RowViewColumnType;
19
20/// Column specification for row-shaped view queries (used by gRPC transport).
21#[derive(Debug, Clone)]
22pub struct ColumnSpec {
23    /// Column name.
24    pub name:        String,
25    /// Column type for SQL casting.
26    pub column_type: RowViewColumnType,
27}
28
29/// A single database column value returned from a row-shaped view query.
30#[derive(Debug, Clone)]
31pub enum ColumnValue {
32    /// Text / varchar value.
33    Text(String),
34    /// 32-bit integer.
35    Int32(i32),
36    /// 64-bit integer.
37    Int64(i64),
38    /// 64-bit floating point.
39    Float64(f64),
40    /// Boolean.
41    Boolean(bool),
42    /// UUID as string.
43    Uuid(String),
44    /// Timestamp with timezone as string.
45    Timestamptz(String),
46    /// Date as string (YYYY-MM-DD).
47    Date(String),
48    /// JSON value as string.
49    Json(String),
50    /// Null value.
51    Null,
52}