dongluoqiu0255 2017-03-07 22:39
浏览 20

google datastore:重大更改re:匿名结构字段?

We have a struct definition like this:

type TimeMs struct {
    time.Time
}

And various of our datastore entity definitions include fields of this type, e.g.:

type Whatever struct {
    Created TimeMs
}

In the past, this always worked fine without any special hackery on our part. If you examine these entities in the cloud console, the field's name was "Created." (note the trailing dot) which was a little odd but didn't seem to cause any problems. However, the latest versions of the cloud datastore package don't seem to play nicely with this. When we attempt to do a client.Put, we get an error of:

unexpected error: rpc error: code = 3 desc = The flattened property.name is the empty string.

We also saw a recent commit of "if nested struct implements PLS, use it" which seemed potentially useful. So we tried making the TimeMs struct implement PropertyLoadSaver (saving its anonymously-embedded time.Time as a property with Name=""), but this results in the same error.

It sure seems like this is a regression. Am I missing something? Is there some kind of workaround that we haven't thought of?

Please note that "just make it implement PropertyLoadSaver and save the Time with some non-empty Name" isn't really viable since we already have (literally) millions of entities stored using "" so it doesn't seem viable to migrate all of them.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)