Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapters #238

Open
18 of 25 tasks
woylie opened this issue Oct 2, 2022 · 0 comments
Open
18 of 25 tasks

Adapters #238

woylie opened this issue Oct 2, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@woylie
Copy link
Owner

woylie commented Oct 2, 2022

Flop was originally written with Ecto in mind, but it can be used with other data sources as well (e.g. lists, HTTP APIs). Especially in combination with Flop.Phoenix, it is convenient to use the same data structures and helpers everywhere. This can already be done today by building a Flop.Meta struct from whatever response you get from a data source, and mapping the Flop struct to whatever parameter format your data source expects to do a query. However, there is no example for this in the documentation at the moment, and it would be great to set the library up for easier extensibility.

Tentative roadmap:

Adapter behaviour

  • define a Flop.Adapter behaviour
  • implement Flop.Adapter behaviour for Flop.Ecto
  • use Flop: add adapter option, compile functions accordingly
  • Flop functions: accept adapter option
  • adapter behaviour: field type
  • update schema field validation to call adapter module
  • update filter value validation to call adapter module
  • update allowed_operators for adapters
  • adapters: disable features #397
  • Adapter.using macro #398

Adapter implementations

Internals

  • replace Flop.Schema.field_type with field_info
  • Flop.Schema.get_field: use adapter
  • revisit apply_order_by
  • revisit cursor_dynamic

Configuration

  • define schema configuration schema via Flop.Adapter behaviour
  • define adapter configuration schema via Flop.Adapter behaviour
  • Flop.Schema: nest adapter-specific configuration
  • use Flop: nest adapter-specific configuration
  • init_backend_opts callback

Wrap up

  • turn Flop.Schema into behaviour
  • cleanly separate all options and type specifications
  • deprecate configuration via application environment in favour of backend modules
  • clean up Flop module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant