Releases: woylie/flop
0.26.3
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:
- Disable the handling of order parameters by passing
ordering: false. - 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
Added
- Recipe for partial UUID filters.
Changed
- Emit warning if ordering parameters are applied and the query already contains
anORDER BYclause.
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
Fixed
- Fixed allowed operators for
Ecto.Enumfields 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_typeto 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
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/2was removed in
favor ofFlop.Schema.field_info/2.
Fixed
- Fixed a compatibility issue with Ecto 3.12 related to the initialization of
theEcto.Enumtype.
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
0.24.1
0.24.0
0.23.0
0.22.1
0.22.0
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.FieldInfostruct that contains metadata for a field for use
by adapters. - Added the
Flop.Schema.field_info/2function, which derives field information
and replaces the previousFlop.Schema.field_type/2function with a more
standardized and structured output.
Changed
- The Ecto-specific options
alias_fields,compound_fields,custom_fields,
andjoin_fieldswithinFlop.Schema, as well asrepoandquery_opts
withinuse Flop, are now nested under theadapter_optskeyword. The old
configuration format is still supported.
Deprecated
Flop.Schema.field_type/2was 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"]
+ ]