If adding to an empty value, set it as an array

If we have an empty field ‘test’ and we specify the sql `SET test += “test”` then we’ll presume it’s going to be an array if it isn’t a number or a decimal.
This commit is contained in:
Tobie Morgan Hitchcock 2017-12-11 17:52:02 +00:00
parent 8849c7c30a
commit 8076afd414

View file

@ -845,6 +845,8 @@ func (d *Doc) Inc(value interface{}, path ...string) (*Doc, error) {
return d.Set(0+inc, path...)
case float64:
return d.Set(0+inc, path...)
default:
return d.Set([]interface{}{value}, path...)
}
case int64:
switch inc := value.(type) {