mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
DESIGN.md
This commit is contained in:
1 parent
df37b031c8
commit
7eccf81221
1 file changed
+13
@@ -33,6 +33,19 @@ More than caveats or defects, there are a few glitches, or surprises in the GRDB
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
// A RowModel that deletes an external resource after being deleted from
|
||||
// the database:
|
||||
class C : RowModel {
|
||||
public func delete(db: Database) throws -> DeletionResult {
|
||||
switch super.delete(db) {
|
||||
case .RowDeleted:
|
||||
try NSFileManager.defaultManager().removeItemAtPath(...)
|
||||
case .NoRowDeleted:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A second reason: the `databaseEdited` flag, which is true when a RowModel has unsaved changes, is easily provided by the base class RowModel. RowModel can manage its internal state *accross method calls*. Protocols could not provide this service without extra complexity.
|
||||
|
||||
Reference in new issue
Block a user