Zunächst einmal bin ich etwas über einem Anfänger in Go und brauche ein wenig Hilfe. Ich dachte, ich behauptet habe (so weit ich gehen habe gelernt), aber ich halte diesen Fehler cannot use readBack["SomePIN"] (type interface {}) as type string in argument to c.String: need type assertion
ERROR: Notwendigkeit Typ Assertion
Hier mein Code (dieser Ausschnitt ist aus einer Handler-Funktion anfordern und ich bin mit Echo-Web-Framework und tiedot NoSQL-Datenbank)
// 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"])
}
}
}