From 7dfcb9f9f6d7cbfc2714a2859d24b1c100835a61 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Wed, 24 Jun 2020 22:48:45 -0700 Subject: [PATCH] Document #124 pagination and find :all --- doc/friendly-sql-functions.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/friendly-sql-functions.md b/doc/friendly-sql-functions.md index a27be3e..6650382 100644 --- a/doc/friendly-sql-functions.md +++ b/doc/friendly-sql-functions.md @@ -124,6 +124,10 @@ Given a table name (as a keyword) and either a hash map of column names and valu "Stella" "stella@artois.beer"]) ``` +`find-by-keys` also supports basic pagination with `:offset` and `:fetch` options which both accept numeric values and adds `OFFSET ? ROWS FETCH NEXT ? ROWS ONLY` to the generated query. To support MySQL and SQLite, you can specify `:limit` instead `:fetch` which adds `LIMIT ? OFFSET ?` to the generated query instead. + +If you want to match all rows in a table -- perhaps with the pagination options in effect -- you can pass the keyword `:all` instead of either a hash map of column names and values or a vector containing a partial `WHERE` clause and parameters. + If no rows match, `find-by-keys` returns `[]`, just like `execute!`. ## `get-by-id`