Answer the question
In order to leave comments, you need to log in
Golang: What does map[string]interface{}{} mean?
While analyzing the open source code of the project, I came across this entry
args := map[string]interface{}{}
func (connect *Connect) Request(request string, params string) (interface{}, error) {
req, err := connect.factory.NewRequest(Host)
if err != nil {
return nil, err
}
args := map[string]interface{}{}
json.Unmarshal([]byte(params), &args)
resp, err := req.Do(request, args)
if err != nil {
return nil, err
}
result, err := resp.GetMethodResult()
if err != nil {
return nil, err
}
return result, nil
}
Answer the question
In order to leave comments, you need to log in
Plain: key:string value:interface{}
args := map[string]interface{}{"apple": 5, "lettuce": 7} так проще?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question