MM-16822 - Implement KVSetWithOptions (#11818)

* Add SetWithOptions

* Avoid passing two structs to the functions

* Rename ExpiryInSeconds -> ExpireInSeconds

* Use t.Run for the tests

* Fix build

* Address feedback

* Update log message

* Update docs and use KVSetWithOptions in KVCompareAndSetJSON

* Improve code style

* Use struct instead of pointer to struct

* Fix minimum server versions

* Update documentation

* Address feedback

* Revert new implemention of kv helpers

* Adress feedback
Этот коммит содержится в:
Gervasio Marchand
2019-11-04 09:49:54 -03:00
коммит произвёл Ben Schumacher
родитель 812c40a307
Коммит 1db045bce3
13 изменённых файлов: 420 добавлений и 77 удалений

Просмотреть файл

@@ -612,6 +612,15 @@ type API interface {
// Minimum server version: 5.16
KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError)
// KVSetWithOptions stores a key-value pair, unique per plugin, according to the given options.
// If options.EncodeJSON is not true, the type of newValue must be of type []byte.
// Returns (false, err) if DB error occurred
// Returns (false, nil) if the value was not set
// Returns (true, nil) if the value was set
//
// Minimum server version: 5.18
KVSetWithOptions(key string, newValue interface{}, options model.PluginKVSetOptions) (bool, *model.AppError)
// KVSet stores a key-value pair with an expiry time, unique per plugin.
//
// Minimum server version: 5.6