InsertionSuccess
The result of a successful record insertion.
struct InsertionSuccess
InsertionSuccess
gives the auto-incremented id after a successful record insertion. For example:
struct Player: Encodable, MutablePersistableRecord {
var id: Int64?
var name: String
mutating func didInsert(_ inserted: InsertionSuccess) {
id = inserted.rowID
}
}
try dbQueue.write { db in
var player = Player(id: nil, name: "Alice")
try player.insert(db)
print(player.id) // The inserted id
}