Expand description
SQL generation from operators
Converts operator enums to PostgreSQL WHERE clause SQL strings. Handles parameter binding, type casting, and operator-specific SQL generation for both JSONB and direct column sources.
§Type Casting Strategy
JSONB fields extracted with ->> are always text. When comparing with non-string values,
we apply explicit type casting:
- String comparisons: No cast needed (text = text)
- Numeric comparisons: Cast to integer or float (text::integer > $1)
- Boolean comparisons: Cast to boolean (text::boolean = true)
- Array comparisons: No special handling (uses array operators)
Direct columns use native types from the database schema.
Functions§
- generate_
where_ operator_ sql - Generates SQL from a WHERE operator with parameter binding support