Flop.validate_and_run

You're seeing just the function validate_and_run, go back to Flop module for more information.
Link to this function

validate_and_run(q, flop, opts \\ [])

View Source (since 0.6.0)

Specs

validate_and_run(Ecto.Queryable.t(), map() | t(), [option()]) ::
  {:ok, {[any()], Flop.Meta.t()}} | {:error, Ecto.Changeset.t()}

Validates the given flop parameters and retrieves the data and meta data on success.

iex> {:ok, {[], %Flop.Meta{}}} =
...>   Flop.validate_and_run(Flop.Pet, %Flop{}, for: Flop.Pet)
iex> {:error, %Ecto.Changeset{} = changeset} =
...>   Flop.validate_and_run(Flop.Pet, %Flop{limit: -1})
iex> changeset.errors
[
  limit: {"must be greater than %{number}",
    [validation: :number, kind: :greater_than, number: 0]}
]

Options

  • for: Passed to Flop.validate/2.
  • repo: The Ecto.Repo module. Required if no default repo is configured.
  • get_cursor_value_func: An arity-2 function to be used to retrieve an unencoded cursor value from a query result item and the order_by fields. Defaults to Flop.Cursor.get_cursor_from_map/2.