multi: add reset closure to kvdb.Update
Similarly as with kvdb.View this commits adds a reset closure to the kvdb.Update call in order to be able to reset external state if the underlying db backend needs to retry the transaction.
This commit is contained in:
44 files changed
+208
-162
No files matched your search
@@ -47,7 +47,7 @@ func ApplyMigration(t *testing.T,
|
||||
|
||||
// beforeMigration usually used for populating the database
|
||||
// with test data.
|
||||
err = kvdb.Update(cdb, beforeMigration)
|
||||
err = kvdb.Update(cdb, beforeMigration, func() {})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -65,14 +65,14 @@ func ApplyMigration(t *testing.T,
|
||||
|
||||
// afterMigration usually used for checking the database state and
|
||||
// throwing the error if something went wrong.
|
||||
err = kvdb.Update(cdb, afterMigration)
|
||||
err = kvdb.Update(cdb, afterMigration, func() {})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Apply migration.
|
||||
err = kvdb.Update(cdb, migrationFunc)
|
||||
err = kvdb.Update(cdb, migrationFunc, func() {})
|
||||
if err != nil {
|
||||
t.Logf("migration error: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user