0.13.0
Added
- Support ordering by join fields.
- Support ordering by compound fields.
- Support join fields as cursor fields.
- New function
Flop.Schema.get_field/2
. Flop.Cursor.get_cursor_from_edge/2
andFlop.Cursor.get_cursor_from_node/2
can get cursor values from join and compound fields now.
Changed
To get the pagination cursor value from a join field, Flop needs to know how
to access the field value from the returned struct or map. The configuration
format for join fields has been changed to allow specifying the path to the
nested field.
Before:
@derive {
Flop.Schema,
join_fields: [
owner_name: {:owner, :name}
]
}
After:
@derive {
Flop.Schema,
join_fields: [
owner_name: [binding: :owner, field: :name, path: [:owner, :name]]
]
}
The :path
is optional and inferred from the :binding
and :field
options,
if omitted.
The old configuration format is still accepted. All of these settings are
equivalent:
[owner_name: {:owner, :name}]
[owner_name: [binding: :owner, field: :name]]
[owner_name: [binding: :owner, field: :name, path: [:owner, :name]]]
Fixed
- Cursor pagination failed when one of the cursor field values was
nil
.