Skip to content

Commit

Permalink
Merge pull request #12 from wuneiii/master
Browse files Browse the repository at this point in the history
ParseResponse support type time.Time
  • Loading branch information
everywan authored Jun 7, 2022
2 parents 6cd7d86 + bb0a2bd commit 59c8bb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/converts/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ func setFieldValue(tag string, field reflect.Value, nValue *nebula_type.Value) e
field.SetFloat(nValue.GetFVal())
case reflect.String:
field.SetString(string(nValue.GetSVal()))
case reflect.Struct:
switch field.Type().String() {
case "time.Time":
ts := nValue.GetIVal()
field.Set(reflect.ValueOf(time.Unix(ts, 0)))
default:
//fmt.Printf("debug: type[%v] mapping not implement\n", field.Type().String())
}
default:
//fmt.Printf("debug: type[%v] mapping not implement\n", field.Type().String())
return nil
}
return nil
Expand Down

0 comments on commit 59c8bb7

Please sign in to comment.