Skip to main content

IndexedColumnsCache

Type Alias IndexedColumnsCache 

Source
pub type IndexedColumnsCache = HashMap<String, HashSet<String>>;
Expand description

Cache of indexed columns for views.

This cache stores column names that follow the FraiseQL indexed column naming conventions:

  • Human-readable: items__product__category__code (double-underscore path)
  • Entity ID format: f{entity_id}__{field_name} (e.g., f200100__code)

When a WHERE clause references a nested path that has a corresponding indexed column, the generator uses the indexed column directly instead of JSONB extraction, enabling the database to use indexes for the query.

§Example

use fraiseql_db::postgres::IndexedColumnsCache;
use std::collections::{HashMap, HashSet};

let mut cache = IndexedColumnsCache::new();

// Register indexed columns for a view
let mut columns = HashSet::new();
columns.insert("items__product__category__code".to_string());
cache.insert("v_order_items".to_string(), columns);

Aliased Type§

pub struct IndexedColumnsCache { /* private fields */ }