Skip to content

Commit

Permalink
Update util.go
Browse files Browse the repository at this point in the history
解析出来的目标对象中,可以支持 time.Time 类型的字段
  • Loading branch information
wuneiii authored Jun 2, 2022
1 parent 6cd7d86 commit bb0a2bd
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 bb0a2bd

Please sign in to comment.