Rustango docs

QuerySet API

rustango::query

The QuerySet<T> builder is lazy: chain filters, then execute with a *_pool terminal.

method QuerySet::filter
pub fn filter(self, predicate: impl Into<Predicate>) -> Self

Narrow the result set. Chainable; ANDs successive calls.

Returns: Self (for chaining)

Post::objects().filter(Post::published.eq(true)).fetch(&pool).await?
method QuerySet::fetch
pub async fn fetch(self, pool: &Pool) -> Result<Vec<T>, ExecError>

Execute the query against a tri-dialect pool and materialize the rows.

Returns: Vec<T>

let rows = Author::objects().fetch(&pool).await?;