Skip to content

Commit

Permalink
fix: remove special enum decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Jun 18, 2024
1 parent a092568 commit 9278f44
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions models/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package models

import (
"fmt"
"reflect"
"strconv"

"github.com/99designs/gqlgen/graphql"
"github.com/mitchellh/hashstructure/v2"
"github.com/mitchellh/mapstructure"
"gopkg.in/go-playground/validator.v9"
Expand Down Expand Up @@ -270,16 +268,6 @@ func ApplyChanges(changes interface{}, to interface{}) error {
TagName: "json",
Result: to,
ZeroFields: true,
DecodeHook: func(_ reflect.Type, b reflect.Type, v interface{}) (interface{}, error) {
if reflect.PointerTo(b).Implements(reflect.TypeOf((*graphql.Unmarshaler)(nil)).Elem()) {
resultType := reflect.New(b)
result := resultType.MethodByName("UnmarshalGQL").Call([]reflect.Value{reflect.ValueOf(v)})
err, _ := result[0].Interface().(error)
return resultType.Elem().Interface(), err
}

return v, nil
},
})
if err != nil {
return fmt.Errorf("failed to create decoder: %w", err)
Expand Down

0 comments on commit 9278f44

Please sign in to comment.