Skip to content

0.22.0

Compare
Choose a tag to compare
@woylie woylie released this 17 Jul 06:16
· 242 commits to main since this release
5b40ca8

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"]
+  ]