Skip to content

Commit

Permalink
DOM: Add handling of more scalar types
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Kosegi <richard.kosegi@gmail.com>
  • Loading branch information
rkosegi committed Sep 10, 2024
1 parent 1b2fe03 commit a7c5e5d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dom/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand All @@ -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))
}
}
Expand Down

0 comments on commit a7c5e5d

Please sign in to comment.