From e6292455db8c8448e08c925b78f4361bbf7d3fce Mon Sep 17 00:00:00 2001 From: Alexandr Pleskot Date: Sat, 25 May 2024 15:19:38 +0200 Subject: [PATCH] fix: add ability to unmarshall objects (#139) --- pkg/marshal/marshal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/marshal/marshal.go b/pkg/marshal/marshal.go index 6e3e1ae..5869343 100644 --- a/pkg/marshal/marshal.go +++ b/pkg/marshal/marshal.go @@ -17,7 +17,7 @@ const StatusOK = "OK" type RawQuery[I any] struct { Status string `json:"status"` Time string `json:"time"` - Result []I `json:"result"` + Result I `json:"result"` Detail string `json:"detail"` } @@ -94,7 +94,7 @@ func SmartUnmarshal[I any](respond interface{}, wrapperError error) (outputs []I // Arr Normal if err = decoder.Decode(&outputs); err != nil { // Arr Raw - var rawArr []RawQuery[I] + var rawArr []RawQuery[[]I] if err = json.Unmarshal(data, &rawArr); err == nil { outputs = make([]I, 0) for _, raw := range rawArr {