まず、Goの初心者の上に少し助けが必要です。 は私が(私はゴーを学んだ限り)主張していると思ったが、私は私のコードは、このエラーここ cannot use readBack["SomePIN"] (type interface {}) as type string in argument to c.String: need type assertion
エラー:タイプアサーションが必要
をされて得続ける(このスニペットは、リクエストハンドラ関数からだと私はエコーWebフレームワークを使用していますそして、TiedotのNoSQLデータベースが)
// To get query result document, simply
// read it [as stated in the Tiedot readme.md]
for id := range queryResult {
readBack, err := aCollection.Read(id)
if err != nil {
panic(err)
}
if readBack["OtherID"] == otherID {
if _, ok := readBack["SomePIN"].(string); ok {
return c.String(http.StatusOK, readBack["SomePIN"])
}
}
}