Go App Engine嵌套对象未存储在Cloud Datastore中

use*_*632 1 google-app-engine go google-cloud-datastore

我有一个实体EmergencyCase有2个嵌入式结构(1个数组和1个结构)当我尝试通过调用以下方法保存EmergencyCase时:

datastore.Put(c, key, &ec)
Run Code Online (Sandbox Code Playgroud)

除了Pos字段(类型位置)之外,所有内容都保存得很好.没有关于此的错误或日志条目.它只是没有存储.有什么建议?

以下是我的3个实体定义:

type Position struct{
    lon float32
    lat float32
}
type EmergencyCase struct{
    // Autogenerated id, not stored in the database.
    ID string `datastore:"-"`
    CreatedAt time.Time
    Closed bool
    ClosedByUser bool `datastore:",noindex"`
    AutoClosed bool `datastore:",noindex"`
    Pos Position
    Events []Event
}

type Event struct{
    // Autogenerated id, not stored in the datastore.
    ID string `datastore:"-"`
    CreatedAt time.Time
    Name string `datastore:",noindex"`
}
Run Code Online (Sandbox Code Playgroud)

Cer*_*món 5

通过大写名称中的第一个字母来导出位置字段名称.数据存储区仅存储导出的字段.

type Position struct{
  Lon float32
  Lat float32
}
Run Code Online (Sandbox Code Playgroud)