所以我有一個(gè)這樣的結(jié)構(gòu)type Bus struct { Number string Name string DirectStations []Station // Station is another struct ReverseStations []Station}我正在嘗試將它的一個(gè)實(shí)例存儲(chǔ)到數(shù)據(jù)存儲(chǔ)區(qū):key := datastore.NewKey(c, "Bus", bus.Number, 0, nil)_, err := datastore.Put(c, key, &bus)但我收到錯(cuò)誤datastore: flattening nested structs leads to a slice of slices: field "DirectStations"怎么解決這個(gè)問題?編輯:原來你不能有一個(gè)結(jié)構(gòu)片,其中該結(jié)構(gòu)包含其他片。
- 2 回答
- 0 關(guān)注
- 190 瀏覽
添加回答
舉報(bào)
0/150
提交
取消