MM-16821 - Add a KVCompareAndDelete to the plugin API (#11804)
* Implement KVCompareAndDelete and KVCompareAndDeleteJSON * Add tests for KVCompareAndDelete * Update minimum server version * Handle nil value on CompareAndSet so that it deletes it * Fix comments * Tweaks from PR comments * Go back to deleted, err
Этот коммит содержится в:
коммит произвёл
Jesse Hallam
родитель
f8ad9f3b8f
Коммит
11b0a20d7d
@@ -22,6 +22,14 @@ type Helpers interface {
|
||||
// Minimum server version: 5.12
|
||||
KVCompareAndSetJSON(key string, oldValue interface{}, newValue interface{}) (bool, error)
|
||||
|
||||
// KVCompareAndDeleteJSON deletes a key-value pair, unique per plugin, but only if the current value matches the given oldValue after marshalling as a JSON string.
|
||||
// Returns (false, err) if DB error occurred
|
||||
// Returns (false, nil) if current value != oldValue or the key was already deleted
|
||||
// Returns (true, nil) if current value == oldValue
|
||||
//
|
||||
// Minimum server version: 5.16
|
||||
KVCompareAndDeleteJSON(key string, oldValue interface{}) (bool, error)
|
||||
|
||||
// KVGetJSON retrieves a value based on the key, unique per plugin, unmarshalling the previously set JSON string into the given value. Returns true if the key exists.
|
||||
KVGetJSON(key string, value interface{}) (bool, error)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user