我认为使用
inline字段标记是您的最佳选择。该氧化镁/ V2 /
BSON文档状态:
inline Inline the field, which must be a struct or a map,causing all of its fields or keys to be processed as ifthey were part of the outer struct. For maps, keys mustnot conflict with the bson keys of other struct fields.
然后,您的结构应定义如下:
type Cube struct { Square `bson:",inline"` Depth int}
编辑
inline``mgo/v1/bson如果您正在使用那个,也存在。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)