Skip to content

Releases: woylie/flop

0.20.2

09 Jun 06:46
4f72005
Compare
Choose a tag to compare

Changed

  • Added nutrition facts about use Flop and @derive Flop.Schema.
  • The minimum Elixir version is now 1.11.

Fixed

  • Fixed a deprecation warning about Logger.warn/1.
  • Fixed a deprecation warning about passing an MFA to :with in
    cast_assoc/cast_embed introduced in Ecto 3.10.2.

0.20.1

19 May 08:27
1150661
Compare
Choose a tag to compare

Added

  • Added the :count override option to Flop.count/3.

Changed

  • The default_pagination_type can now be set in the schema.

Fixed

  • Don't raise function clause error in Flop.to_previous_cursor/1 and
    Flop.to_next_cursor/1 when the start cursor or end cursor are nil.

0.20.0

21 Mar 01:11
e90ad37
Compare
Choose a tag to compare

Added

  • Added Flop.unnest_filters/3 as a reverse operation of Flop.nest_filters/3
    after retrieving data from the database.
  • Added Flop.Filter.fetch_value/2, Flop.Filter.get_value/2,
    Flop.Filter.put_value/4, Flop.Filter.put_new_value/4,
    Flop.Filter.pop_value/3 and Flop.Filter.pop_first_value/3.

Changed

  • Several of the functions for manipulating lists of filters in the
    Flop.Filter module now accept lists of maps with atom keys, lists of maps
    with string keys, and indexed maps as produced by Phoenix HTML forms as
    argument.
  • The empty and not_empty operators now treat empty maps as empty values on
    map fields and empty arrays as empty values on array fields.
  • % and _ characters in filter values for the like, ilike and =~
    operators are now escaped.

Fixed

  • Fixed an issue that caused filter conditions for like_and, like_or,
    ilike_and and ilike_or to be incorrectly combined when applied to compound
    fields.

0.19.0

15 Jan 05:50
5f5bd95
Compare
Choose a tag to compare

Added

  • Support for custom fields. These fields allow you to run custom filter
    functions for anything that cannot be expressed with Flop filters.
  • Added Flop.with_named_bindings/4 for dynamically adding bindings needed for
    a Flop query.
  • Added fetch, get, get_all, delete, delete_first, drop, new,
    take, pop, pop_first, put and put_new functions to Flop.Filter.
  • Added Flop.Meta.with_errors/3.
  • Added ecto_type option to join fields.
  • Added not_like and not_ilike filter operators.
  • Added a cheatsheet for schema configuration.

Changed

  • Renamed Flop.bindings/3 to Flop.named_bindings/3.
  • Flop.Filter.allowed_operators/2 now tries to determine the Ecto type by
    reading the Flop field type from the schema module. This function is used
    during parameter validation, which means the validation step will be a bit
    stricter now. For join and custom fields, the Ecto type is determined via the
    new ecto_type option. If the option is not set, the function returns all
    operators as before. For compound fields, only the supported operators are
    returned.
  • Added opts field to Flop.Meta struct.

0.18.4

17 Nov 12:10
6680f60
Compare
Choose a tag to compare

Changed

  • The :ilike_and, :ilike_or, :like_and and :like_or filter operators can
    now also be used with a list of strings as filter value.

0.18.3

27 Oct 10:59
fef4f6d
Compare
Choose a tag to compare

Fixed

  • default_pagination_type can be overridden by passing false now.

0.18.2

19 Oct 05:08
Compare
Choose a tag to compare

Fixed

  • Flop.bindings/3 did not consider join fields that are used as part of a
    compound field.

0.18.1

13 Oct 23:12
7dce7f1
Compare
Choose a tag to compare

Changed

  • If the given map already has a :filters / "filters" key,
    Flop.nest_filters/3 will now merge the derived filters into the existing
    filters. If the existing filters are formatted as a map (as produced by an
    HTML form), they are converted to a list first.
  • use Flop will now also compile validate/2 and validate!/2 functions that
    apply the options of your config module.
  • Allow setting default_limit and max_limit to false, which removes the
    default/max limit without falling back to global options.

Fixed

  • Flop.bindings/1 was returning bindings for filters with nil values.

0.18.0

10 Oct 06:28
8d9706b
Compare
Choose a tag to compare

Added

  • Added alias_fields option to Flop.Schema, which allows you to sort by
    field aliases defined with Ecto.Query.selected_as/2.
  • Added aliases/2 for getting the alias fields needed for a query.
  • Added documentation example for filtering by calculated values.
  • New option rename for Flop.map_to_filter_params/2 and
    Flop.nest_filters/3.
  • New option :replace_invalid_params. This option can be passed to the
    validate and validate_and_run functions or set in the global configuration
    or in a config module. Setting the value to true will cause Flop to replace
    invalid parameters with default values where possible or remove the parameter
    otherwise during the validation step, instead of returning validation errors.

Changed

  • Require ecto ~> 3.9.0.
  • Flop.Schema does not raise an error anymore if a compound or join field is
    defined with the same name as a regular Ecto schema field. This was done so that
    you can add virtual fields with the same name. It is not possible to
    differentiate between non-virtual and virtual fields at compile time (at least
    I don't know how), so we cannot differentiate in the validation step.
  • Flop applies a default limit of 50 and a max limit of 1000 now, unless
    other values are set.
  • In offset/limit based pagination, the limit parameter is now required, in
    line with the other pagination types. If not set, it will fall back to a
    default limit.

0.17.2

03 Oct 09:36
0.17.2
9647fbb
Compare
Choose a tag to compare

Fixed

  • Fixed an issue where the repo option was not read from a backend module.