pub type PostgresWhereGenerator = GenericWhereGenerator<PostgresDialect>;Expand description
PostgreSQL WHERE clause generator.
Type alias for GenericWhereGenerator<PostgresDialect>.
Refer to GenericWhereGenerator for full documentation.
§Example
use fraiseql_db::postgres::PostgresWhereGenerator;
use fraiseql_db::{WhereClause, WhereOperator};
use serde_json::json;
let generator = PostgresWhereGenerator::postgres_new();
let clause = WhereClause::Field {
path: vec!["email".to_string()],
operator: WhereOperator::Icontains,
value: json!("example.com"),
};
let (sql, params) = generator.generate(&clause).expect("Failed to generate SQL");
// sql: "data->>'email' ILIKE '%' || $1 || '%'"Aliased Type§
pub struct PostgresWhereGenerator { /* private fields */ }Implementations§
Source§impl PostgresWhereGenerator
Constructor compatibility shim for PostgresWhereGenerator.
impl PostgresWhereGenerator
Constructor compatibility shim for PostgresWhereGenerator.
These impl blocks expose the same new() / with_indexed_columns()
constructors that the old concrete struct had.
Sourcepub const fn postgres_new() -> Self
pub const fn postgres_new() -> Self
Create a new PostgreSQL WHERE generator.
Sourcepub fn postgres_with_indexed_columns(
indexed_columns: Arc<HashSet<String>>,
) -> Self
pub fn postgres_with_indexed_columns( indexed_columns: Arc<HashSet<String>>, ) -> Self
Create a new PostgreSQL WHERE generator with indexed columns for a view.
When indexed columns are provided, the generator uses them instead of JSONB extraction for nested paths that have corresponding indexed columns.
§Arguments
indexed_columns- Set of indexed column names for the current view
§Example
use fraiseql_db::postgres::PostgresWhereGenerator;
use std::collections::HashSet;
use std::sync::Arc;
let mut columns = HashSet::new();
columns.insert("items__product__category__code".to_string());
let generator = PostgresWhereGenerator::postgres_with_indexed_columns(Arc::new(columns));