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

Go App Engine nested objects are not stored in Cloud Datastore

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

datastore.Put(c, key, &ec)

除 Pos 字段(类型 Position)外,所有内容都存储良好。没有关于此的错误或日志条目。它只是没有存储。有什么建议吗?

这是我的 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"`
}

尝试使用 appengine.GeoPoint 作为 altenative/optimised class

Export the Position field names by uppercasing the first letter in the name. The datastore stores exported fields only.

type Position struct{
  Lon float32
  Lat float32
}