golang吧 关注:6,535贴子:14,828
  • 0回复贴,共1

golang怎么给struct设置未知类型

取消只看楼主收藏回复

type A struct {
Age int `json:"age"
}
type B struct {
Id int `json:"id"
}
type C struct {
Data []struct{} `json:"data"`
}
C的Data需要按需求存放A或者B的数组,这个Data的类型应该怎么设置?


1楼2018-06-08 11:19回复