add support to make map separator configurable

This commit is contained in:
Rene Zbinden
2020-02-14 10:47:58 +01:00
committed by Alec Thomas
parent ca3a30c5f1
commit 529703d8d1
4 changed files with 23 additions and 2 deletions
+2 -1
View File
@@ -408,6 +408,7 @@ func mapDecoder(r *Registry) MapperFunc {
target.Set(reflect.MakeMap(target.Type()))
}
el := target.Type()
sep := ctx.Value.Tag.MapSep
var childScanner *Scanner
if ctx.Value.Flag != nil {
t := ctx.Scan.Pop()
@@ -417,7 +418,7 @@ func mapDecoder(r *Registry) MapperFunc {
}
switch v := t.Value.(type) {
case string:
childScanner = Scan(SplitEscaped(v, ';')...)
childScanner = Scan(SplitEscaped(v, sep)...)
case []map[string]interface{}:
for _, m := range v {