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