This commit is contained in:
Mike Schwörer 2023-06-07 17:45:45 +02:00
parent f7dce4a102
commit 827b3fc1b7
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.148" const GoextVersion = "0.0.149"
const GoextVersionTimestamp = "2023-06-07T17:22:38+0200" const GoextVersionTimestamp = "2023-06-07T17:45:45+0200"

View File

@ -46,10 +46,14 @@ func (pss PrimitiveStringSerializer) ValueToString(v any) (string, error) {
func (pss PrimitiveStringSerializer) ValueFromString(str string, outType reflect.Type) (any, error) { func (pss PrimitiveStringSerializer) ValueFromString(str string, outType reflect.Type) (any, error) {
if str == "" { if outType.Kind() == reflect.Ptr && str == "" {
return reflect.Zero(outType).Interface(), nil // = nil.(outType), nil return reflect.Zero(outType).Interface(), nil // = nil.(outType), nil
} }
if str == "" {
return reflect.Zero(outType).Interface(), nil // = <default>(outType), nil
}
if outType.Kind() == reflect.Ptr { if outType.Kind() == reflect.Ptr {
innerValue, err := pss.ValueFromString(str, outType.Elem()) innerValue, err := pss.ValueFromString(str, outType.Elem())