Counting Records With Ecto
Last updated
Was this helpful?
Last updated
Was this helpful?
Sometimes you want to know how many records there are in a table. Ecto gives us a couple ways to approach this.
We can use the function that the Ecto query API provides.
Alternatively, we can use the function to use PostgreSQL's count
function.
Lastly, Ecto.Repo
has the function which provides a :count
option.