出于性能原因,我正在 Go 中的 Google AppEngine 项目中编写一个模块,但需要能够从我在数据存储中的一些实体中读取。我写出了 Go 代码,以便能够读取我在 Python 中构建的实体,但出现以下错误:datastore: flattening nested structs leads to a slice of slices: field "Messages"Python 中的模型定义:class ModelB(ndb.Model): msg_id = ndb.StringProperty(indexed=False) cat_ids = ndb.StringProperty(repeated=True, indexed=False) list_ids = ndb.StringProperty(repeated=True, indexed=False) default_list_id_index = ndb.IntegerProperty(indexed=False)class ModelA(ndb.Model): date_join = ndb.DateTimeProperty(auto_now_add=True) name = ndb.StringProperty() owner_salutation = ndb.StringProperty(indexed=False) owner_email_address = ndb.StringProperty() logo_url = ndb.StringProperty(indexed=False) ... messages = ndb.LocalStructuredProperty(ModelB, name='bm', repeated=True)在 Go 中:type ModelB struct { MessageID string `datastore:"msg_id,noindex"` CategoryIDs []string `datastore:"cat_ids,noindex"` ListIDs []string `datastore:"list_ids,noindex"` DefaultListIDIndex int `datastore:"default_list_id_index,noindex"`}type ModelA struct { DateJoin time.Time `datastore:"date_join,"` Name string `datastore:"name,"` OwnerSalutation string `datastore:"owner_salutation,noindex"` OwnerEmailAddress string `datastore:"owner_email_address,"` LogoURL string `datastore:"logo_url,noindex"` Messages []ModelB `datastore:"bm,"`}我在这里做错了吗?仅仅是 Go 与 Python 模型定义之间的功能不兼容吗?
- 3 回答
- 0 关注
- 234 浏览
添加回答
举报
0/150
提交
取消