Flop.query
You're seeing just the function
query
, go back to Flop module for more information.
Specs
query(Ecto.Queryable.t(), t()) :: Ecto.Queryable.t()
Adds clauses for filtering, ordering and pagination to a
Ecto.Queryable.t/0
.
The parameters are represented by the Flop.t/0
type. Any nil
values
will be ignored.
Examples
iex> flop = %Flop{limit: 10, offset: 19}
iex> Flop.query(Flop.Pet, flop)
#Ecto.Query<from p0 in Flop.Pet, limit: ^10, offset: ^19>
Or enhance an already defined query:
iex> require Ecto.Query
iex> flop = %Flop{limit: 10}
iex> Flop.Pet |> Ecto.Query.where(species: "dog") |> Flop.query(flop)
#Ecto.Query<from p0 in Flop.Pet, where: p0.species == "dog", limit: ^10>
Note that when using cursor-based pagination, the applied limit will be
first + 1
or last + 1
. The extra record is removed by Flop.run/3
.