go - 什么是 locationName 标签以及如何使用它们?
问题描述
我正在查看适用于 aws ec2 的 go SDK。我不明白为什么 SDK 中几乎所有的结构都有这个标签:`locationName'
例如类型 DescribeInstancesOutput 结构 {
// The token to use 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"`
// Zero or more reservations.
Reservations []*Reservation `***locationName***:"reservationSet" locationNameList:"item" type:"list"`
// contains filtered or unexported fields
有谁知道标签的用途?
来源 - https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#DescribeInstancesOutput
解决方案
通过搜索源代码,它似乎与内部 json/xml 解析/编码一起使用。这类似于json
标签的使用方式encoding/json
。
这个答案在 go 中的标签上非常深入。
它们可以与reflect
包一起访问/使用。
推荐阅读
- python-3.x - 自定义数据范围
- android - 拖动布局在 Android Studio 中不起作用
- angular - Linux 到 windows 命令 | 使用 SpringBoot 进行角度设置
- csv - 如何在不排序的情况下从 csv 文件中删除重复项
- mysql - 原子更新和备份 ON DUPLICATE KEY 插入 else - golang sql 语句
- reactjs - 反应网格布局 x,y,w,h
- javascript - 即使使用 Object.assign,Redux 初始状态也会发生变化
- spring - 弹簧数据存在于某列的所有值中
- oauth-2.0 - 本地交换的 Outlook Web 加载项令牌身份验证失败
- android - 什么 firebase 检查电子邮件有效或不用于新用户注册?