Skip to content

Commit 8670d1c

Browse files
committed
Add filtering examples
Signed-off-by: Stephen Celis <stephen@stephencelis.com>
1 parent 2f2ca7d commit 8670d1c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Documentation/Index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,18 @@ SQLite.swift filters rows using a [query’s](#queries) `filter` function with a
602602
``` swift
603603
users.filter(id == 1)
604604
// SELECT * FROM "users" WHERE ("id" = 1)
605+
606+
users.filter(contains([1, 2, 3, 4, 5], id))
607+
// SELECT * FROM "users" WHERE (id IN (1, 2, 3, 4, 5))
608+
609+
users.filter(like("%@mac.com", email))
610+
// SELECT * FROM "users" WHERE ("email" LIKE '%@mac.com')
611+
612+
users.filter(verified && lower(name) == "alice")
613+
// SELECT * FROM "users" WHERE ("verified" AND (lower("name") == 'alice'))
614+
615+
users.filter(verified || balance >= 10_000)
616+
// SELECT * FROM "users" WHERE ("verified" OR ("balance" >= 10000.0))
605617
```
606618

607619
You can build your own boolean expressions by using one of the many [filter operators and functions](#filter-operators-and-functions).

0 commit comments

Comments
 (0)