英文:
Google Datastore nested entity's in Golang
问题
我在设计我的模型时遇到了一些问题,因为我的模型包含了一个切片的切片,我得到了一个错误信息:
将嵌套结构展平会导致切片的切片
在设计这样的模型时,最好的方法是什么?
我更倾向于改变我的设计,而不是像这篇帖子中建议的那样创建自己的序列化方法:
type Inner2 struct {
Y float64
inner3 []Inner3
}
type Inner3 struct {
Z bool
}
type Outer struct {
A int16
I []Inner2
}
英文:
I having some problems with design my model ,
Because my model contains slice of a slice and im getting an error
flattening nested structs leads to a slice of slices
What will be the best approach to design something like that
I prefer to change my design instead of create my own serialize method like suggested in this post:
type Inner2 struct {
Y float64
inner3 []Inner3
}
type Inner3 struct {
Z bool
}
type Outer struct {
A int16
I []Inner2
}
答案1
得分: 2
这个问题将在几天内修复,修复的地方是 cloud.google.com/go/datastore,将支持嵌套实体值!
详细信息请参阅此帖子:
https://groups.google.com/forum/#!topic/google-api-go-announce/79jtrdeuJAg
英文:
Fix for this is coming in a few days to cloud.google.com/go/datastore -- support for nested entity values!
See post here for details:
https://groups.google.com/forum/#!topic/google-api-go-announce/79jtrdeuJAg
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论