Electric.Shapes.Filter.WhereCondition (electric v1.4.13)
View SourceResponsible for knowing which shapes are affected by a change to a specific table.
When add_shape/4 is called, shapes are added to a tree stored in ETS. Each node on the tree represents
an optimised (indexed) condition in the shape's where clause, with shapes that share an optimised condition
being on the same branch.
Each WhereCondition is identified by a unique reference and stores:
index_keys: MapSet of {field, operation} tuples for indexed conditionsother_shapes: map of shape_id -> where_clause for non-optimized shapes
The logic for specific indexes (equality, inclusion) is handled by dedicated modules that also use ETS.
Summary
Functions
@spec remove_shape( Electric.Shapes.Filter.t(), reference(), String.t(), Electric.Replication.Eval.Expr.t() | nil ) :: :deleted | :ok
Remove a shape from a WhereCondition.
Returns :deleted if the condition is now empty and was deleted,
or :ok if the condition still has shapes.