8000 Releases · woylie/flop · GitHub
[go: up one dir, main page]

Skip to content

Releases: woylie/flop

0.26.3

29 May 12:15
460bd5d

Choose a tag to compare

Fixed

  • Allow resetting default order set on schema by passing
    default_order: false.

Upgrade notes

Flop 0.26.2 introduced a new warning when Flop order parameters are set and the
query already has an order by clause. Order by parameters are added to the Flop
struct either by passing the order_by and order_directions parameters to
the validate function or by defining a default_order in the Ecto schema.

To prevent the warning:

  1. Disable the handling of order parameters by passing ordering: false.
  2. Override the default order set in the schema by passing
    default_order: false.

Example:

query = from p in Pet, order_by: :name
flop = Flop.validate!(params, for: Pet, ordering: false, default_order: false)
Flop.run(query, flop)

0.26.2

28 May 13:26
24f34e0

Choose a tag to compare

Added

  • Recipe for partial UUID filters.

Changed

  • Emit warning if ordering parameters are applied and the query already contains
    an ORDER BY clause.

Fixed

  • Fix "protocol Enumerable not implemented for type X" error when there is a
    validation error and a filter value is a struct.

0.26.1

19 Aug 01:30
dacfe88

Choose a tag to compare

Fixed

  • Fixed allowed operators for Ecto.Enum fields in Ecto 3.12.
  • Fixed type expansion when passing values with shortened syntax to
    Flop.Filter.expand_type/1.
  • Updated documentation example for setting ecto_type to parameterized types.

Upgrade Guide

If you pass a parameterized type as ecto_type option, ensure that you use
Ecto.ParameterizedType.init/2 instead of using the tuple representation as
suggested in the documentation before. The tuple representation is an internal
representation of Ecto and was changed in Ecto 3.12.

[
-  ecto_type: {:parameterized, Ecto.Enum, Ecto.Enum.init(values: [:one, :two])}
+  ecto_type: Ecto.ParameterizedType.init(Ecto.Enum, values: [:one, :two])
]

For Ecto.Enum specifically, you can also use the short syntax
{:ecto_enum, [:one, :two]}.

0.26.0

18 Aug 01:23
051526e

Choose a tag to compare

Removed

  • The previously deprecated tuple syntax for defining join fields has been
    removed in favor of a keyword list.
  • The previously deprecated function Flop.Schema.field_type/2 was removed in
    favor of Flop.Schema.field_info/2.

Fixed

  • Fixed a compatibility issue with Ecto 3.12 related to the initialization of
    the Ecto.Enum type.

Upgrade Guide

Replace the tuple syntax for join fields with a keyword list.

@derive {
  Flop.Schema,
  join_fields: [
-    owner_name: {:owner, :name}
+    owner_name: [
+      binding: :owner,
+      field: :name
+    ]
  ]
}

0.25.0

14 Jan 01:18
5cb212c

Choose a tag to compare

Added

  • Added Flop.Filter.update_value/3 for updating the filter value for a field
    in a list of filters.

Fixed

  • Determine pagination type if pagination parameter has errors.

0.24.1

18 Nov 05:38
13a5e02

Choose a tag to compare

Changed

  • Flop.push_order/3 now allows you to use a descending order as the initial
    sort order.

0.24.0

14 Nov 11:20
46bf7b1

Choose a tag to compare

Changed

  • If an invalid operator is passed in a filter, the error will now include the
    list of allowed operators for that field.

0.23.0

26 Sep 00:32
37dd91b

Choose a tag to compare

Added

  • Added directions option to Flop.push_order/3.

Fixed

  • Escape backlash character in queries using one of the like operators.

0.22.1

18 Jul 12:19
e36c3b1

Choose a tag to compare

Fixed

  • Updated version requirement for Ecto to ~> 3.10.3. Flop 0.22.0 relies
    on a feature added in that version and doesn't compile with lower versions.
9536

0.22.0

17 Jul 06:16
5b40ca8

Choose a tag to compare

This release includes a substantial refactoring to lay the groundwork for the
upcoming adapter feature. While this release contains deprecations and changes,
they are either backward compatible or affect functions that are unlikely to be
used by end users. The primary aim has been to ensure a seamless transition and
maintain compatibility with previous versions.

Added

  • Added a Flop.FieldInfo struct that contains metadata for a field for use
    by adapters.
  • Added the Flop.Schema.field_info/2 function, which derives field information
    and replaces the previous Flop.Schema.field_type/2 function with a more
    standardized and structured output.

Changed

  • The Ecto-specific options alias_fields, compound_fields, custom_fields,
    and join_fields within Flop.Schema, as well as repo and query_opts
    within use Flop, are now nested under the adapter_opts keyword. The old
    configuration format is still supported.

Deprecated

  • Flop.Schema.field_type/2 was deprecated in favor of
    Flop.Schema.field_info/2.

Removed

  • Removed Flop.Schema.apply_order_by/3.
  • Removed Flop.Schema.cursor_dynamic/3.

Upgrade guide

While the old configuration format is still supported, you are invited to
update your application to the new structure to prepare for future versions.

To do this, place the field configuration for Flop.Schema under
adapter_opts:

@derive {
  Flop.Schema,
  filterable: [],
  sortable: [],
-  alias_fields: [],
-  compound_fields: [],
-  custom_fields: [],
-  join_fields: []
+  adapter_opts: [
+    alias_fields: [],
+    compound_fields: [],
+    custom_fields: [],
+    join_fields: []
+  ]
}

Similarly for use Flop, you can nest repo and query_opts under
adapter_opts:

use Flop,
  default_limit: 50,
-  repo: MyApp.Repo,
-  query_opts: [prefix: "some-prefix"]
+  adapter_opts: [
+    repo: MyApp.Repo,
+    query_opts: [prefix: "some-prefix"]
+  ]
0