我是GO的新手。

我的目标是获取item.Data中的数据并将其放入映射中,以便我可以将它们作为键值对进行访问。

据我了解,空接口与Typescript中的任何类型都一样。

您可以在goLang中分享如何做的摘要吗?

type SearchLogsResponse struct {

    // The underlying http response
    RawResponse *http.Response

    // A list of SearchResponse instances
    SearchResponse `presentIn:"body"`

    // For list pagination. When this header appears in the response, additional pages
    // of results remain. For important details about how pagination works, see
    // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).
    OpcNextPage *string `presentIn:"header" name:"opc-next-page"`

    // Unique Oracle-assigned identifier for the request. If you need to contact
    // Oracle about a particular request, please provide the request ID.
    OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}

// SearchResult日志搜索结果条目

type SearchResult struct {

    // JSON blob containing the search entry with projected fields.
    Data *interface{} `mandatory:"true" json:"data"`
}


// SearchResponse Search response object.
type SearchResponse struct {
    Summary *SearchResultSummary `mandatory:"true" json:"summary"`

    // List of search results
    Results []SearchResult `mandatory:"false" json:"results"`

    // List of log field schema information.
    Fields []FieldInfo `mandatory:"false" json:"fields"`
}

res, err1 := o.loggingSearchClient.SearchLogs(ctx, request)
    for _, item := range res.Results {

            //TODO create a map string [string]

            // Put key value pairs from item into the above map




}

PS:item.Data中的数据是键值对的列表,其中每个键可以在另一个值为字符串的接口内包含数据

包含数据的界面的屏幕截图