From 470e1534dc7318441fa1fcaf3bb2f7ce1836e46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 28 Oct 2018 22:29:15 +0100 Subject: [PATCH] Documentation --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36a438fd1..7b7ebcf21 100644 --- a/README.md +++ b/README.md @@ -6332,7 +6332,7 @@ Sometimes you need to observe several requests at the same time, and be notified ```swift struct TeamInfo { var team: Team - var player: [Player] + var players: [Player] } let teamRequest = Team.filter(key: 1) @@ -6449,13 +6449,17 @@ let observer = dbQueue.add( ```swift let observation = ValueObservation.observing( teamRequest, playersRequest, - fetch { db in - // some + fetch { db in + // write access allowed }) observation.isReadOnly = false ``` - When you use a [database pool](#database-pools), an observation is less efficient when it is not read-only. + The `fetch` closure is executed inside a [savepoint](#transactions-and-savepoints). + + Don't use this flag unless you actually need it: when you use a [database pool](#database-pools), observations with write access are less efficient. + + See [RxSwiftCommunity/RxGRDB/issues/42](https://github.com/RxSwiftCommunity/RxGRDB/issues/42) for an example use case. The `isReadOnly` flag exists in order to address this feature request. ## FetchedRecordsController