mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
DocC organization
This commit is contained in:
1 parent
e994fca2b5
commit
e22bf8fe0a
6 files changed
+56
-12
No files matched your search
@@ -445,10 +445,21 @@ extension DatabaseWriter {
|
||||
|
||||
// MARK: - Transaction Observers
|
||||
|
||||
/// Adds a transaction observer, so that it gets notified of
|
||||
/// database changes and transactions.
|
||||
/// Adds a transaction observer to the writer connection, so that it
|
||||
/// gets notified of database changes and transactions.
|
||||
///
|
||||
/// This method has no effect on read-only database connections.
|
||||
/// This method waits until all currently executing database accesses
|
||||
/// performed by the writer dispatch queue finish executing.
|
||||
/// At that point, database observation begins.
|
||||
///
|
||||
/// It has no effect on read-only database connections.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```swift
|
||||
/// let myObserver = MyObserver()
|
||||
/// try dbQueue.add(transactionObserver: myObserver)
|
||||
/// ```
|
||||
///
|
||||
/// - parameter transactionObserver: A transaction observer.
|
||||
/// - parameter extent: The duration of the observation. The default is
|
||||
@@ -461,7 +472,18 @@ extension DatabaseWriter {
|
||||
writeWithoutTransaction { $0.add(transactionObserver: transactionObserver, extent: extent) }
|
||||
}
|
||||
|
||||
/// Removes a transaction observer.
|
||||
/// Removes a transaction observer from the writer connection.
|
||||
///
|
||||
/// This method waits until all currently executing database accesses
|
||||
/// performed by the writer dispatch queue finish executing.
|
||||
/// At that point, database observation stops.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```swift
|
||||
/// let myObserver = MyObserver()
|
||||
/// try dbQueue.remove(transactionObserver: myObserver)
|
||||
/// ```
|
||||
public func remove(transactionObserver: some TransactionObserver) {
|
||||
writeWithoutTransaction { $0.remove(transactionObserver: transactionObserver) }
|
||||
}
|
||||
|
||||
@@ -2,11 +2,20 @@ extension Database {
|
||||
|
||||
// MARK: - Database Observation
|
||||
|
||||
/// Adds a transaction observer, so that it gets notified of
|
||||
/// database changes and transactions.
|
||||
/// Adds a transaction observer on the database connection, so that it
|
||||
/// gets notified of database changes and transactions.
|
||||
///
|
||||
/// This method has no effect on read-only database connections.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```swift
|
||||
/// let myObserver = MyObserver()
|
||||
/// try dbQueue.write { db in
|
||||
/// db.add(transactionObserver: myObserver)
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// - parameter transactionObserver: A transaction observer.
|
||||
/// - parameter extent: The duration of the observation. The default is
|
||||
/// the observer lifetime (observation lasts until observer
|
||||
@@ -26,7 +35,16 @@ extension Database {
|
||||
observationBroker.add(transactionObserver: transactionObserver, extent: extent)
|
||||
}
|
||||
|
||||
/// Removes a transaction observer.
|
||||
/// Removes a transaction observer from the database connection.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```swift
|
||||
/// let myObserver = MyObserver()
|
||||
/// try dbQueue.write { db in
|
||||
/// db.remove(transactionObserver: myObserver)
|
||||
/// }
|
||||
/// ```
|
||||
public func remove(transactionObserver: some TransactionObserver) {
|
||||
SchedulingWatchdog.preconditionValidQueue(self)
|
||||
guard let observationBroker else { return }
|
||||
|
||||
@@ -20,14 +20,20 @@ GRDB puts this SQLite feature to some good use, and lets you observe the databas
|
||||
- ``ValueObservation``
|
||||
- ``SharedValueObservation``
|
||||
- ``AsyncValueObservation``
|
||||
- ``Database/registerAccess(to:)``
|
||||
|
||||
### Observing Database Transactions
|
||||
|
||||
- ``DatabaseRegionObservation``
|
||||
- ``Database/afterNextTransaction(onCommit:onRollback:)``
|
||||
|
||||
### Low-Level Transaction Observers
|
||||
|
||||
- ``TransactionObserver``
|
||||
- ``Database/add(transactionObserver:extent:)``
|
||||
- ``Database/remove(transactionObserver:)``
|
||||
- ``DatabaseWriter/add(transactionObserver:extent:)``
|
||||
- ``DatabaseWriter/remove(transactionObserver:)``
|
||||
- ``Database/TransactionObservationExtent``
|
||||
|
||||
### Database Regions
|
||||
|
||||
@@ -78,8 +78,7 @@ A `DatabasePool` needs your application to follow rules in order to deliver its
|
||||
|
||||
### Accessing the Database
|
||||
|
||||
See ``DatabaseReader`` and ``DatabaseWriter`` for more database
|
||||
access methods.
|
||||
See ``DatabaseReader`` and ``DatabaseWriter`` for more database access methods.
|
||||
|
||||
- ``asyncConcurrentRead(_:)``
|
||||
- ``writeInTransaction(_:_:)``
|
||||
|
||||
@@ -91,8 +91,7 @@ A `DatabaseQueue` needs your application to follow rules in order to deliver its
|
||||
|
||||
### Accessing the Database
|
||||
|
||||
See ``DatabaseReader`` and ``DatabaseWriter`` for more database
|
||||
access methods.
|
||||
See ``DatabaseReader`` and ``DatabaseWriter`` for more database access methods.
|
||||
|
||||
- ``inDatabase(_:)``
|
||||
- ``inTransaction(_:_:)``
|
||||
|
||||
@@ -93,7 +93,7 @@ let players: [Player] = try dbQueue.read { db in
|
||||
- <doc:RecordTimestamps>
|
||||
- <doc:SingleRowTables>
|
||||
|
||||
### Database Tools
|
||||
### Application Tools
|
||||
|
||||
- <doc:DatabaseObservation>
|
||||
- <doc:FullTextSearch>
|
||||
|
||||
Reference in new issue
Block a user