mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Enhance CHANGELOG
This commit is contained in:
1 parent
37a434a615
commit
dfcb44016f
1 file changed
+6
-5
+6
-5
@@ -5,7 +5,7 @@ Release Notes
|
||||
|
||||
**New**
|
||||
|
||||
- The RecordBox class brings changes tracking to any record type ([documentation](https://github.com/groue/GRDB.swift/blob/master/README.md#recordbox-class)):
|
||||
- The new RecordBox class brings changes tracking to any record type ([documentation](https://github.com/groue/GRDB.swift/blob/master/README.md#recordbox-class)):
|
||||
|
||||
```swift
|
||||
// A regular record struct
|
||||
@@ -13,15 +13,16 @@ Release Notes
|
||||
|
||||
try dbQueue.inDatabase { db in
|
||||
// Fetch a boxed player
|
||||
if let player = try RecordBox<Player>.fetchOne(db, key: 1) {
|
||||
player.value.score = 300
|
||||
if let boxedPlayer = try RecordBox<Player>.fetchOne(db, key: 1) {
|
||||
// boxedPlayer.value is Player
|
||||
boxedPlayer.value.score = 300
|
||||
|
||||
if player.hasPersistentChangedValues {
|
||||
if boxedPlayer.hasPersistentChangedValues {
|
||||
print("player has been modified")
|
||||
}
|
||||
|
||||
// Does nothing if player has not been modified:
|
||||
try player.updateChanges(db)
|
||||
try boxedPlayer.updateChanges(db)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user