From 2c4d17af82f5e96e34be64f406c55f55e21a5ce6 Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Wed, 22 Apr 2020 19:55:13 -0700 Subject: [PATCH] add limit example --- docs/content/en/docs/Getting started/writing_queries.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/content/en/docs/Getting started/writing_queries.md b/docs/content/en/docs/Getting started/writing_queries.md index f0ed3201..aa9a1cdc 100644 --- a/docs/content/en/docs/Getting started/writing_queries.md +++ b/docs/content/en/docs/Getting started/writing_queries.md @@ -47,6 +47,12 @@ details on expressions, see [this guide]({{< relref "expressions.md" >}}). ### Limit You can limit the amount of results returned by calling `limit` on queries. The method accepts the amount of rows to return and an optional offset. +```dart +Future> limitTodos(int limit, {int offset}) { + return (select(todos)..limit(limit, offset: offset)).get(); +} +``` + ### Ordering You can use the `orderBy` method on the select statement. It expects a list of functions that extract the individual ordering terms from the table.