View Source Cinema.Projection.Lens (cinema v0.1.0)
The Elixir.Cinema.Projection.Lens
module provides a struct for defining lenses which can be used to manipulate
the inputs to a given projection.
Lenses can be used to filter, scope, or otherwise manipulate the inputs to a given projection.
See the Elixir.Cinema.Projection.Lens.apply/3
and Elixir.Cinema.Projection.Lens.build!/2
functions for more information.
Summary
Functions
Uses the given Elixir.Cinema.Projection.Lens.t()
to manipulate inputs to the given projection.
Builds a new Elixir.Cinema.Projection.Lens.t()
struct with the given filters
and optional reducer
.
See Elixir.Cinema.Projection.Lens.apply/3
for more information.
Types
Functions
@spec apply(t(), module(), Keyword.t()) :: Enumerable.t() | Ecto.Query.t()
Uses the given Elixir.Cinema.Projection.Lens.t()
to manipulate inputs to the given projection.
If the given Elixir.Cinema.Projection.Lens.t()
has a reducer
function, a given input projection's output
will be reduced over with the given filters
, allowing you to customize the behaviour of how
a projection's inputs are scoped or modified.
If the given Elixir.Cinema.Projection.Lens.t()
does not have a reducer
function, the given filters
will
be used to filter the given input projection's output the same way Ecto.Query.where/3
does
when given a static Keyword.t()
as a final argument.
Returns either the manipulated queryable, or a stream capturing said queryable depending on if
as_stream: true
is passed in the opts
argument.
@spec build!( filters :: list(), ({filter :: atom(), value :: term()}, acc :: Ecto.Query.t() | module() -> Ecto.Query.t() | module()) | nil ) :: t()
Builds a new Elixir.Cinema.Projection.Lens.t()
struct with the given filters
and optional reducer
.
See Elixir.Cinema.Projection.Lens.apply/3
for more information.