dwyl / dwyl/alog

Should All function be able to take queries?

Open
#29 2 comments 0 reactions 2 assignees Assigned to @Danwhy View on GitHub
discuss enhancement question technical
Dominant language
Elixir
Stars
15
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Should we be able to pass a query to the `all` function?

Currently `all` gets all the the distinct `:entry_id`s from the database, orders the results and removes any values where deleted is true.

This works well but does not allow us to do any further database queries.

For example, if you wanted to retrieve a list of all users from a user table who were under 50. With `Ecto.Repo` you would be able to pass in a query that looks something like...
```elixir
query = from(u in user, where: u.age < 50)
Repo.all(query)
```

The database does all the logic and returns only the data you need.

With the current `all` in `alog` we would need to retrieve all users and then filter them ourselves in app.

@danwhy @nelsonic any thoughts/suggestions on how we can extent the `all` function to all users to pass in any query but still keep/use the current query?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.