我试图理解这个Go结构:
type ListClustersOutput struct {
_ struct{} `type:"structure"`
// A list of all of the clusters for your account in the specified Region.
Clusters []*string `locationName:"clusters" type:"list"`
// The nextToken value to include in a future ListClusters request. When the
// results of a ListClusters request exceed maxResults, you can use this value
// to retrieve the next page of results. This value is null when there are no
// more results to return.
NextToken *string `locationName:"nextToken" type:"string"`
}
查看文档:https://golangdocs.com/structs-in-golang#defining-a-struct-in-go
它给出了一个例子:
type Fruit struct {
name string
}
这似乎非常不同。
在更复杂的代码中,我认为这等同于但努力解压缩它。Clusters []*string `locationName:"clusters" type:"list"`name string
我正在努力找出很多东西 - 大多数例子似乎都是指切片。他们为什么使用?type: "list"list
什么是 ?locationName
如何访问该结构中列表的第一个元素?
请注意,对于最后一个问题,如果我使用(where is of this struct类型),我会得到一个指针。例如:result.Clusters[0]result
fmt.Println("Result: ", result.Clusters[0])
Result: 0xc000372260
如何取消引用它?
跃然一笑
芜湖不芜
相关分类