Genesis.Query (genesis v0.5.1)
View SourceProvides helper functions to query objects in the registry.
Summary
Functions
Returns a list of objects that have all the aspects specified in the list.
Returns a list of objects that have at least one of the aspects specified in the list.
Returns a list of objects that do not have any of the aspects specified in the list.
Functions
Returns a list of objects that have all the aspects specified in the list.
Examples
iex> Query.all_of([Aspect1, Aspect2])
[{1, [Aspect1, Aspect2]}, {2, [Aspect1, Aspect2]}]
Returns a list of objects that have at least one of the aspects specified in the list.
Examples
iex> Query.any_of([Aspect1, Aspect2])
[{1, [Aspect1]}, {2, [Aspect2]}, {3, [Aspect1, Aspect2]}]
Returns a list of objects that do not have any of the aspects specified in the list.
Examples
iex> Query.none_of([Aspect1, Aspect2])
[{3, [Aspect3, Aspect4]}, {4, [Aspect4, Aspect5]}]
Returns a list of objects that match the specified criteria.
The function allows grouping the behavior of all_of/1
, any_of/1
, and none_of/1
.
Examples
iex> Query.query(all: [Aspect1], any: [Aspect2], none: [Aspect3])
[{1, [Aspect1, Aspect2]}, {2, [Aspect1]}]