 
 #endif
 
-typealias DatabaseEventPredicate = (DatabaseEventProtocol) -> Bool
+enum DatabaseEventPredicate {
+    case `true`
+    case function((DatabaseEventProtocol) -> Bool)
+    
+    func evaluate(_ event: DatabaseEventProtocol) -> Bool {
+        switch self {
+        case .true: return true
+        case .function(let f): return f(event)
+        }
+    }
+}
 
 /// The SQLite savepoint stack is described at
 /// https://www.sqlite.org/lang_savepoint.html

    private func databaseWillChange(with event: DatabasePreUpdateEvent) {
        if savepointStack.isEmpty {
            // Notify now
            for (observation, predicate) in activeTransactionObservations where predicate(event) {
                observation.databaseWillChange(with: event)
            }
        } else {
            // Buffer
            savepointStack.eventsBuffer.append((event: event.copy(), observations: activeTransactionObservations))
        }
    }
#endif

///   rollbacked.
class SavepointStack {
    /// The buffered events. See Database.didChange(with:)
    var eventsBuffer: [(event: DatabaseEventProtocol, statementObservations: [(TransactionObservation, DatabaseEventPredicate)])] = []
    
    /// The savepoint stack, as an array of tuples (savepointName, index in the eventsBuffer array).
    /// Indexes let us drop rollbacked events from the event buffer.
