Releases: woylie/flop
Releases · woylie/flop
0.20.2
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
Added
- Added the
:count
override option toFlop.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 arenil
.
0.20.0
Added
- Added
Flop.unnest_filters/3
as a reverse operation ofFlop.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
andFlop.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
andnot_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 thelike
,ilike
and=~
operators are now escaped.
Fixed
- Fixed an issue that caused filter conditions for
like_and
,like_or
,
ilike_and
andilike_or
to be incorrectly combined when applied to compound
fields.
0.19.0
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
andput_new
functions toFlop.Filter
. - Added
Flop.Meta.with_errors/3
. - Added
ecto_type
option to join fields. - Added
not_like
andnot_ilike
filter operators. - Added a cheatsheet for schema configuration.
Changed
- Renamed
Flop.bindings/3
toFlop.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
newecto_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 toFlop.Meta
struct.
0.18.4
0.18.3
0.18.2
0.18.1
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 compilevalidate/2
andvalidate!/2
functions that
apply the options of your config module.- Allow setting
default_limit
andmax_limit
tofalse
, which removes the
default/max limit without falling back to global options.
Fixed
Flop.bindings/1
was returning bindings for filters withnil
values.
0.18.0
Added
- Added
alias_fields
option toFlop.Schema
, which allows you to sort by
field aliases defined withEcto.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
forFlop.map_to_filter_params/2
and
Flop.nest_filters/3
. - New option
:replace_invalid_params
. This option can be passed to the
validate
andvalidate_and_run
functions or set in the global configuration
or in a config module. Setting the value totrue
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 of1000
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.