summaryrefslogtreecommitdiffstats
path: root/store/sql_supplier.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-17 15:05:17 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-17 10:05:17 -0400
commit22459ee17a3ba0b4487f975b6ebe630cab2d9feb (patch)
tree275d8b68561d1c5046416d04264efc35806b8342 /store/sql_supplier.go
parent4e92d1801733410c47bdde29c4bda4d52210d4e7 (diff)
downloadchat-22459ee17a3ba0b4487f975b6ebe630cab2d9feb.tar.gz
chat-22459ee17a3ba0b4487f975b6ebe630cab2d9feb.tar.bz2
chat-22459ee17a3ba0b4487f975b6ebe630cab2d9feb.zip
PLT-7302: Aggregate Elasticsearch indexes over a certain age. (#7224)
* PLT-7302: Aggregate Elasticsearch indexes over a certain age. This is done by a scheduled daily job, in order to keep the shard count to a sensible level in Elasticsearch. * Use map[string]string instead of StringMap
Diffstat (limited to 'store/sql_supplier.go')
-rw-r--r--store/sql_supplier.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/store/sql_supplier.go b/store/sql_supplier.go
index 5b9c268bb..f56a9f448 100644
--- a/store/sql_supplier.go
+++ b/store/sql_supplier.go
@@ -786,6 +786,8 @@ func (me mattermConverter) ToDb(val interface{}) (interface{}, error) {
switch t := val.(type) {
case model.StringMap:
return model.MapToJson(t), nil
+ case map[string]string:
+ return model.MapToJson(model.StringMap(t)), nil
case model.StringArray:
return model.ArrayToJson(t), nil
case model.StringInterface:
@@ -809,6 +811,16 @@ func (me mattermConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
return json.Unmarshal(b, target)
}
return gorp.CustomScanner{Holder: new(string), Target: target, Binder: binder}, true
+ case *map[string]string:
+ binder := func(holder, target interface{}) error {
+ s, ok := holder.(*string)
+ if !ok {
+ return errors.New(utils.T("store.sql.convert_string_map"))
+ }
+ b := []byte(*s)
+ return json.Unmarshal(b, target)
+ }
+ return gorp.CustomScanner{Holder: new(string), Target: target, Binder: binder}, true
case *model.StringArray:
binder := func(holder, target interface{}) error {
s, ok := holder.(*string)