1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//! Type-safe SQL expression system.
//!
//! This module provides a type-safe wrapper around SQL expressions that tracks:
//! - The SQL data type of the expression
//! - Whether the expression can be NULL
//! - Whether the expression is an aggregate or scalar
//!
//! # Example
//!
//! ```ignore
//! use drizzle_core::expr::*;
//!
//! // Type-safe comparisons
//! let condition = eq(users.id, 10); // OK: Int == Int
//! // let bad = eq(users.id, "hello"); // ERROR: Int != Text
//!
//! // Type-safe arithmetic
//! let total = users.price + users.tax; // OK: both Numeric
//! // let bad = users.name + users.id; // ERROR: Text + Int
//! ```
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
// ops has only trait impls - no items to re-export
pub use *;
pub use *;
use crate;
use crateDataType;
// =============================================================================
// Sealed Trait Pattern
// =============================================================================
// =============================================================================
// Nullability Markers
// =============================================================================
/// Marker trait for nullability state.
/// Marker indicating an expression cannot be NULL.
;
/// Marker indicating an expression can be NULL.
;
// =============================================================================
// Aggregate Kind Markers
// =============================================================================
/// Marker trait for expression aggregation state.
/// Marker indicating a scalar (non-aggregate) expression.
;
/// Marker indicating an aggregate expression (COUNT, SUM, etc.).
;
// =============================================================================
// Core Expression Trait
// =============================================================================
/// An expression in SQL with an associated data type.
///
/// This is the core trait for type-safe SQL expressions. Every SQL expression
/// (column, literal, function result) implements this with its SQL type.
///
/// # Type Parameters
///
/// - `'a`: Lifetime of borrowed data in the expression
/// - `V`: The dialect's value type (SQLiteValue, PostgresValue)
///
/// # Associated Types
///
/// - `SQLType`: The SQL data type this expression evaluates to
/// - `Nullable`: Whether this expression can be NULL
/// - `Aggregate`: Whether this is an aggregate or scalar expression
///
/// # Example
///
/// ```ignore
/// use drizzle_core::expr::{Expr, NonNull, Scalar};
/// use drizzle_core::types::Int;
///
/// // i32 literals are Int, NonNull, Scalar
/// fn check_expr<'a, V, E: Expr<'a, V>>() {}
/// check_expr::<_, i32>(); // SQLType=Int, Nullable=NonNull, Aggregate=Scalar
/// ```
// Note: Columns implement Expr via explicit impls generated by macros,
// not via a blanket impl, to avoid conflicts with `impl Expr for &T`.