Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Go 为什么GAE数据存储中不支持简单结构字段类型?_Go_Google Cloud Datastore - Fatal编程技术网

Go 为什么GAE数据存储中不支持简单结构字段类型?

Go 为什么GAE数据存储中不支持简单结构字段类型?,go,google-cloud-datastore,Go,Google Cloud Datastore,正在失败,并显示以下消息: &errors.errorString{s:“数据存储:不支持的结构字段类型:sus.Version”} 我有一个要保存到GAE数据存储的测试结构类型: type foo struct{ sus.Version } 其中sus.Version是接口: type Version interface{ GetVersion() int getVersion() int incrementVersion() decrementVe

正在失败,并显示以下消息:

&errors.errorString{s:“数据存储:不支持的结构字段类型:sus.Version”}

我有一个要保存到GAE数据存储的测试结构类型:

type foo struct{
    sus.Version
}
其中sus.Version是接口:

type Version interface{
    GetVersion() int
    getVersion() int
    incrementVersion() 
    decrementVersion() 
}
我尝试使用两个版本实现运行测试,第一个版本只是int的别名:

type version int
第二,作为一个结构:

type version struct{
    val int
}
如果给定了版本接口方法的接收器类型
(v*Version)
,那么它需要是一个指针,这样减量和增量实际上会更新调用它们的版本,而不仅仅是一个副本。我不确定这为什么不起作用,可能是因为它是一个匿名字段?或者可能是因为它是指向int或struct的指针,而不是实际的int或struct?

不允许使用所有类型。特别是,它只允许使用以下类型:

- signed integers (int, int8, int16, int32 and int64), - bool, - string, - float32 and float64, - []byte (up to 1 megabyte in length), - any type whose underlying type is one of the above predeclared types, - ByteString, - *Key, - time.Time (stored with microsecond precision), - appengine.BlobKey, - appengine.GeoPoint, - structs whose fields are all valid value types, - slices of any of the above. -带符号整数(int、int8、int16、int32和int64), -布尔, -弦, -浮动32和浮动64, -[]字节(最长可达1兆字节), -基础类型为上述预声明类型之一的任何类型, -通过测试环, -*关键, -时间。时间(以微秒精度存储), -阿彭金·布洛基, -阿彭金地质点, -字段均为有效值类型的结构, -上面任何一种的切片。 请注意,这不包括“任何接口类型”