How to loadTag a slice list?
liaohongxing opened this issue · comments
type Person struct {
Name string `json:"name"`
Age int `json:"age"`
Field1 carbon.Carbon `json:"field1" carbon:"type:date" tz:"PRC"`
Field2 carbon.Carbon `json:"field2" carbon:"type:time" tz:"PRC"`
Field3 carbon.Carbon `json:"field3" carbon:"type:dateTime" tz:"PRC"`
}
list := make([]models.Person, 0)
if err := carbon.LoadTag(&list); err != nil {
return nil, nil, err
}
将切片传入报错 reflect: call of reflect.Value.NumField on slice Value
v2.3.12 has been released, temporarily use the following instead
type Person struct {
Name string `json:"name"`
Age int `json:"age"`
Field1 carbon.Date `json:"field1"`
Field2 carbon.Time `json:"field2"`
Field3 carbon.DateTime `json:"field3"`
}