0
:[ストリング]インターフェイス{}マップを使用して次のコードを考える
type Message struct {
Params map[string]interface{} `json:"parameters"`
Result interface{} `json:"result"`
}
func (h Handler) Product(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
msg := &Message{
Action: "get_products",
Params: {
"id1": val1,
"id2": val2,
},
}
h.route(msg)
}
アイデアはID1 => VAL1、ID2 => VAL2未知量のブロックを送信できるようにすることであるが... h.routeに。
それは私に、このエラーを与える:
missing type in composite literal
が、それはあなたの 'Action'がすべきことをタイプミスです「結果」ですか?それとも構造体で定義するのを忘れたフィールドですか? – nevets