Translates SCIM filter ASTs into Ecto WHERE clauses.
Supported SCIM filter operators
- Comparison:
eq,ne,gt,ge,lt,le - String matching:
co(contains),sw(starts with),ew(ends with) - Presence:
pr(is not null) - Logical:
and,or,not
Options
The 3-arity apply_filter/3 accepts an opts keyword list:
:filter_mapping- maps SCIM attribute paths to Ecto field atoms or{:assoc, assoc_name, field_name}tuples for association filtering:field_mapping- maps domain field atoms to{db_field, to_fn, from_fn}tuples for value transformation during filtering:schema_fields- list of valid schema field atoms, used to reject unknown filter attributes
Field resolution
SCIM attribute paths are resolved in this order:
- Explicit
:filter_mappingentry (if configured) - Auto-derived by converting camelCase to snake_case and looking up the atom
- If the resolved field has a
:field_mappingentry, the filter value is transformed throughto_fnbefore comparison
When filtering on associations, LEFT JOINs are added automatically and
results are made DISTINCT to avoid duplicate root records.
Summary
Functions
Applies a SCIM filter AST to an Ecto query.
Applies a SCIM filter AST to an Ecto query with options.
Functions
Applies a SCIM filter AST to an Ecto query.
Returns the query unchanged if filter_ast is nil.
Returns a modified Ecto.Query with WHERE clauses added.
Applies a SCIM filter AST to an Ecto query with options.
Supports filter_mapping, field_mapping, and schema_fields options.
Automatically adds LEFT JOINs for association-based filters.
Returns a modified Ecto.Query with WHERE clauses added.