From a7c5e5d365b7abcfcbb0e7229f5c740d1c82eee2 Mon Sep 17 00:00:00 2001 From: Richard Kosegi Date: Tue, 10 Sep 2024 11:17:33 +0200 Subject: [PATCH] DOM: Add handling of more scalar types Signed-off-by: Richard Kosegi --- dom/codec.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dom/codec.go b/dom/codec.go index eb87753..8175ff0 100644 --- a/dom/codec.go +++ b/dom/codec.go @@ -64,7 +64,9 @@ func decodeListFn(v []interface{}, l ListBuilder) { list := &listBuilderImpl{} decodeListFn(item.([]interface{}), list) l.Append(list) - case reflect.Int, reflect.Float64, reflect.String, reflect.Bool: + case reflect.Float32, reflect.Float64, reflect.String, reflect.Bool, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: l.Append(decodeLeafFn(item)) } } @@ -82,7 +84,9 @@ func decodeContainerFn(current *map[string]interface{}, parent ContainerBuilder) decodeContainerFn(&ref, parent.AddContainer(k)) case reflect.Slice, reflect.Array: decodeListFn(v.([]interface{}), parent.AddList(k)) - case reflect.Int, reflect.Float64, reflect.String, reflect.Bool: + case reflect.Float32, reflect.Float64, reflect.String, reflect.Bool, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: parent.AddValue(k, decodeLeafFn(v)) } }