ash-project / ash-project/ash

Non-macro alternative to `Ash.Query.filter`

Open
#1,092 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
2.5k
Forks
422
Avg merge
23h 26m
Merged PRs (30d)
46

Description

All `Ash.Query` modifications - `select`, `sort`, `limit`, `offset`, `build` and so on - are usual methods. Except one, the most used - `filter` - it is a macro. So it needs a require statement to be used. Which is a little bit annoying when you want to add a simple filter and only once in a file... I just go for `build(filter:)` combo in that case.

Would be convenient to have non-macro variant of `filter` exposed (which is `do_filter`). Maybe under name `where`?

In small discussion on Discord the following proposal was made: add `where` in Ash 3.1 (because there are too many things already in Ash 3 and it is too late to change `filter` to non-macro method even though it is desirable) and make it a primary way to add filters to queries in docs, then in Ash 4 deprecate `filter`.

Contributor guide

Open the contributing guide

Research direction

Start by reading the Ash.Query.filter macro, its do_filter implementation, and the existing build(filter:) path mentioned in the issue. Check how query modifiers are exposed and documented; done means an agreed non-macro API and compatible documentation/deprecation plan for the stated Ash 3.1/Ash 4 transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.