DatabasePreUpdateEvent

public struct DatabasePreUpdateEvent

Undocumented

  • An event kind

    See more

    Declaration

    Swift

    public enum Kind : Int32
  • The event kind

    Declaration

    Swift

    public let kind: Kind
  • The database name

    Declaration

    Swift

    public var databaseName: String { get }
  • The table name

    Declaration

    Swift

    public var tableName: String { get }
  • The number of columns in the row that is being inserted, updated, or deleted.

    Declaration

    Swift

    public var count: Int { get }
  • 1 for inserts, updates, or deletes invoked by top-level triggers; 2 for changes resulting from triggers called by top-level triggers; … and so forth

    Declaration

    Swift

    public var depth: CInt { get }
  • The initial rowID of the row being changed for .Update and .Delete changes, and nil for .Insert changes.

    Declaration

    Swift

    public let initialRowID: Int64?
  • The final rowID of the row being changed for .Update and .Insert changes, and nil for .Delete changes.

    Declaration

    Swift

    public let finalRowID: Int64?
  • The initial database values in the row.

    Values appear in the same order as the columns in the table.

    The result is nil if the event is an .Insert event.

    Declaration

    Swift

    public var initialDatabaseValues: [DatabaseValue]? { get }
  • Returns the initial DatabaseValue at given index.

    Indexes span from 0 for the leftmost column to (row.count - 1) for the righmost column.

    The result is nil if the event is an .Insert event.

    Declaration

    Swift

    public func initialDatabaseValue(atIndex index: Int) -> DatabaseValue?
  • The final database values in the row.

    Values appear in the same order as the columns in the table.

    The result is nil if the event is a .Delete event.

    Declaration

    Swift

    public var finalDatabaseValues: [DatabaseValue]? { get }
  • Returns the final DatabaseValue at given index.

    Indexes span from 0 for the leftmost column to (row.count - 1) for the righmost column.

    The result is nil if the event is a .Delete event.

    Declaration

    Swift

    public func finalDatabaseValue(atIndex index: Int) -> DatabaseValue?
  • Returns an event that can be stored:

    class MyObserver: TransactionObserver {
        var events: [DatabasePreUpdateEvent]
        func databaseWillChange(with event: DatabasePreUpdateEvent) {
            events.append(event.copy())
        }
    }
    

    Declaration

    Swift

    public func copy() -> DatabasePreUpdateEvent