DatabaseRegion
public struct DatabaseRegion : CustomStringConvertible, Equatableextension DatabaseRegion: DatabaseRegionConvertibleDatabaseRegion defines a region in the database. DatabaseRegion is dedicated
to help transaction observers recognize impactful database changes in their
observes(eventsOfKind:) and databaseDidChange(with:) methods.
A database region is the union of any number of “table regions”, which can cover a full table, or the combination of columns and rows:
|Table1 |   |Table2 |   |Table3 |   |Table4 |   |Table5 |
|-------|   |-------|   |-------|   |-------|   |-------|
|x|x|x|x|   |x| | | |   |x|x|x|x|   |x|x| |x|   | | | | |
|x|x|x|x|   |x| | | |   | | | | |   | | | | |   | |x| | |
|x|x|x|x|   |x| | | |   | | | | |   |x|x| |x|   | | | | |
|x|x|x|x|   |x| | | |   | | | | |   | | | | |   | | | | |
To create a database region, you use one of those methods:
- DatabaseRegion.fullDatabase: the region that covers all database tables.
- DatabaseRegion(): the empty region.
- DatabaseRegion(table:): the region that covers one database table.
- SelectStatement.databaseRegion:- let statement = try db.makeSelectStatement(sql: "SELECT name, score FROM player") let region = statement.databaseRegion
- FetchRequest.databaseRegion(_:)- let request = Player.filter(key: 1) let region = try request.databaseRegion(db)
- 
                  
                  Returns whether the region is empty. DeclarationSwift public var isEmpty: Bool { get }
- 
                  
                  The region that covers the full database: all columns and all rows from all tables. DeclarationSwift public static let fullDatabase: DatabaseRegion
- 
                  
                  Creates an empty database region. DeclarationSwift public init()
- 
                  
                  Creates a region that spans all rows and columns of a database table. DeclarationSwift public init(table: String)ParameterstableA table name. 
- 
                  
                  Returns the union of this region and the given one. DeclarationSwift public func union(_ other: DatabaseRegion) -> DatabaseRegion
- 
                  
                  Inserts the given region into this region DeclarationSwift public mutating func formUnion(_ other: DatabaseRegion)
- 
                  
                  Returns whether the content in the region would be impacted if the database were modified by an event of this kind. DeclarationSwift public func isModified(byEventsOfKind eventKind: DatabaseEventKind) -> Bool
- 
                  
                  Returns whether the content in the region is impacted by this event. Precondition event has been filtered by the same region in the TransactionObserver.observes(eventsOfKind:) method, by calling region.isModified(byEventsOfKind:)DeclarationSwift public func isModified(by event: DatabaseEvent) -> Bool
 View on GitHub
View on GitHub Install in Dash
Install in Dash DatabaseRegion Structure Reference
        DatabaseRegion Structure Reference