Repo and Ecto.Query giving me Protocol.UndefinedError at GET /post

Hello,

sorry if it’s a stupid question, but I didn’t find anything in the docs regarding my topic.

So is it possible to do anything like that:

    Post
    |> Repo.all()
    |> Repo.preload(:comments)
    |> Repo.preload(:users)
    |> Ecto.Query.limit(10)
    |> offset(30)

I want to implement a pagination. Currently, I’m getting this error:

 Protocol.UndefinedError at GET /post
protocol Ecto.Queryable not implemented fo

Without the limit and offset the statement works as defined. Before looking for solutions to the problem, I want to make sure, if it is even possible what I’m trying to do or if I’m mixing something.

Thanks for any help!