Phoenix Framework: How can I pass :infinity value as parameter for Ecto.query

Viewed 68

How can I pass :infinity value as parameter for Ecto.query.

from(query, limit: ^limit, offset: ^offset)

Since the limit value here is :infinity, I am getting the following error.

value `:infinity` in `limit` cannot be cast to type :integer in query

How can I make a query where there is no limit for such a query (because I can get too many results as a result of the query)?

Is there any proper way to do it?

1 Answers

Remove the limit from the statement and you will get all of the records for the table.

from(query, offset: ^offset)

Or you could just query the table:

Repo.all(User)
Related