-
Notifications
You must be signed in to change notification settings - Fork 10
Conditional Operations
put-item!, delete-item! and update-item! accept a :when
option,
consisting of a nest of vectors, describing conditions which are required to
hold for the operation to succeed.
query! & scan! accept a :filter
option with identical structure (used for Dynamo-side filtering of query results).
In addition to :and
, :or
& :not
, the
supported operations are:
[:begins-with path substring]
[:exists path]
[:contains path substring-or-set-member]
[:in path [v1 v2 .. v100]]
[:between path lo hi]
-
:<
,:<=
,:=
,:>
,:>=
,:<>
Paths are vectors describing locations within an item - a top-level attribute
[:attr]
, or nested value [:attr :key]
, [:list-attr 0 :list-key 2]
.
Generally, the operators will interpret a vector passed as the first argument to be an attribute path, and a vector as the second to be a literal.
In the rare cases when it's necessary, explicitly distinguishing attribute paths
from literal vectors can be done with the #hildebrand/path
and
#hildebrand/literal
reader tags (or by applying metadata).
[:and
[:<= [:age] 34]
[:in [:age] [30 33 34]]
[:not [:in [:age] #{30 34}]]
[:or
[:begins-with [:hobby] "Sta"]
[:begins-with [:hobby] "Stra"]]]
[:and
[:or
[:between [:age] 10 30]
[:between [:age] 33 40]]
[:exists [:garbage]]]
[:= 30 30]
[:= [:data :age] 30]