Added multi-database support to snapshot module

This commit is contained in:
Kelvin Mwinuka
2024-06-29 23:31:55 +08:00
parent 56f0a5ce61
commit 182195ebc3
6 changed files with 307 additions and 278 deletions

View File

@@ -25,7 +25,7 @@ func createEchoVaultWithConfig(conf config.Config) *EchoVault {
}
func presetValue(server *EchoVault, ctx context.Context, key string, value interface{}) error {
ctx = context.WithValue(ctx, "Database", "0")
ctx = context.WithValue(ctx, "Database", 0)
if err := server.setValues(ctx, map[string]interface{}{key: value}); err != nil {
return err
}
@@ -33,7 +33,7 @@ func presetValue(server *EchoVault, ctx context.Context, key string, value inter
}
func presetKeyData(server *EchoVault, ctx context.Context, key string, data internal.KeyData) {
ctx = context.WithValue(ctx, "Database", "0")
ctx = context.WithValue(ctx, "Database", 0)
_ = server.setValues(ctx, map[string]interface{}{key: data.Value})
server.setExpiry(ctx, key, data.ExpireAt, false)
}