Open RobStallion opened 5 years ago
My first thoughts are that we can either use another subquery when a query is given as a parameter, or we reduce the queries into a single one, similar to what we're doing with the get_by
function.
We'd have to try them out to see if either of them actually work/which is better though
@RobStallion great question and thank you for capturing it in this issue! 👍
We should attempt to make our all/1
function as similar to Ecto's Repo.all/1
as possible
to minimise the friction to adoption or "cognitive load" people have when learning how to query an append-only log.
As @Danwhy says, we should try this out and see how simple we can make it.
Ideally all queries in alog
should be Ecto Queryables so that they can be chained.
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...The database does all the logic and returns only the data you need.
With the current
all
inalog
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?