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
@@ -1903,6 +1903,29 @@ func (_m *API) HasPermissionToTeam(userId string, teamId string, permission *mod
|
||||
return r0
|
||||
}
|
||||
|
||||
// KVCompareAndDelete provides a mock function with given fields: key, oldValue
|
||||
func (_m *API) KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError) {
|
||||
ret := _m.Called(key, oldValue)
|
||||
|
||||
var r0 bool
|
||||
if rf, ok := ret.Get(0).(func(string, []byte) bool); ok {
|
||||
r0 = rf(key, oldValue)
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, []byte) *model.AppError); ok {
|
||||
r1 = rf(key, oldValue)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// KVCompareAndSet provides a mock function with given fields: key, oldValue, newValue
|
||||
func (_m *API) KVCompareAndSet(key string, oldValue []byte, newValue []byte) (bool, *model.AppError) {
|
||||
ret := _m.Called(key, oldValue, newValue)
|
||||
|
||||
@@ -33,6 +33,27 @@ func (_m *Helpers) EnsureBot(bot *model.Bot) (string, error) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// KVCompareAndDeleteJSON provides a mock function with given fields: key, oldValue
|
||||
func (_m *Helpers) KVCompareAndDeleteJSON(key string, oldValue interface{}) (bool, error) {
|
||||
ret := _m.Called(key, oldValue)
|
||||
|
||||
var r0 bool
|
||||
if rf, ok := ret.Get(0).(func(string, interface{}) bool); ok {
|
||||
r0 = rf(key, oldValue)
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, interface{}) error); ok {
|
||||
r1 = rf(key, oldValue)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// KVCompareAndSetJSON provides a mock function with given fields: key, oldValue, newValue
|
||||
func (_m *Helpers) KVCompareAndSetJSON(key string, oldValue interface{}, newValue interface{}) (bool, error) {
|
||||
ret := _m.Called(key, oldValue, newValue)
|
||||
|
||||
Ссылка в новой задаче
Block a user