ExSift.Query (ex_sift v0.2.0)
Core query matching logic for ExSift.
This module handles parsing and matching MongoDB-style queries against values.
Supports any type implementing the ExSift.Collection protocol.
Summary
Functions
Checks if a map contains any operator keys (starting with $).
Tests if a value matches a query.
Functions
Checks if a map contains any operator keys (starting with $).
Tests if a value matches a query.
Examples
iex> ExSift.Query.matches?(%{age: 30}, %{age: 30})
true
iex> ExSift.Query.matches?(%{age: 30}, %{age: %{"$gt" => 25}})
true
iex> ExSift.Query.matches?(MapSet.new([1, 2, 3]), %{"$size" => 3})
true
iex> ExSift.Query.matches?([a: 1, b: 2], %{"a" => 1})
true