From fadb80df5d315743ab9e0b2f959a44c347adbed3 Mon Sep 17 00:00:00 2001 From: Alexej Kubarev Date: Sat, 17 Feb 2024 20:12:40 +0100 Subject: [PATCH] readme: Update to reflect handling of empty data types --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 7072cec..0ae3490 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,23 @@ Response is decoded following similar rules to argument encoding. * Structs may contain pointers - they will be initialized if required. * Structs may be parsed as `map[string]any`, in case struct member names are not known at compile time. Map keys are enforced to `string` type. +#### Handling of Empty Values + +If XML-RPC response contains no value for well-known data-types, it will be decoded into the default "empty" values as per table below: + +| XML-RPC Value | Default Value | +|-------------------------|--------------| +| `` | `""` | +| ``, `` | `0` | +| `` | `false` | +| `` | `0.0` | +| `` | `time.Time{}` | +| `` | `nil` | +| `` | `nil` | + +As per XML-RPC specification, `` may not have an empty list of `` elements, thus no default "empty" value is defined for it. +Similarly, `` is considered invalid. + ### Field renaming XML-RPC specification does not necessarily specify any rules for struct's member names. Some services allow struct member names to include characters not compatible with standard Go field naming.