Skip to content

Commit

Permalink
fix: 适配 gf框架 gtime
Browse files Browse the repository at this point in the history
  • Loading branch information
v_llxjliu committed Jun 18, 2024
1 parent 4465100 commit 3d64a14
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions filter/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,15 @@ func parserStruct(typeOf reflect.Type, valueOf reflect.Value, t *fieldNodeTree,

valueInterface := value.Interface()
if v, ok := valueInterface.(json.Marshaler); ok {
if _, ok1 := value.Addr().Interface().(GTime); ok1 {
marshalJSON, err := v.MarshalJSON()
if err != nil {
fmt.Println("json marshal error:", err)
} else {
str := string(marshalJSON)
value = reflect.ValueOf(strings.Trim(str, `"`))
if value.CanAddr() {
if _, ok1 := value.Addr().Interface().(GTime); ok1 {
marshalJSON, err := v.MarshalJSON()
if err != nil {
fmt.Println("json marshal error:", err)
} else {
str := string(marshalJSON)
value = reflect.ValueOf(strings.Trim(str, `"`))
}
}
}

Expand Down

0 comments on commit 3d64a14

Please sign in to comment.