Skip to content

Commit

Permalink
fix: add ability to unmarshall objects (surrealdb#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAA1exa8 committed May 25, 2024
1 parent bc55e64 commit e629245
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/marshal/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e629245

Please sign in to comment.