Go Wiki:眾所皆知的結構標籤

背景

Go 提供 結構標籤,讓其透過反射技術發現。這些標籤在標準函式庫的 JSON/XML 和其他編碼套件中享有廣泛的應用。

社群歡迎這些標籤,並開發 ORM、進一步編碼、旗標解析器以及許多其他應用,特別用於這些任務時,單一來源有助於資料結構。

問題描述

由於 Go 和 Go 結構標籤 的使用量增加,發生衝突是不可避免的。

解決方案

下表經過盡力整理,記錄可用於公眾的套件所使用的眾所皆知結構標籤。

清單格式

舉例說明

標籤 文件說明
xml https://pkg.go.dev/encoding/xml

變更管理

任一建立公開套件並使用新標籤者都可加入清單項目。當套件文件的連結無法使用或此套件作者提出請求時,可移除清單項目。

廣為人知的結構標籤清單

標籤 文件說明
xml https://pkg.go.dev/encoding/xml
json https://pkg.go.dev/encoding/json
asn1 https://pkg.go.dev/encoding/asn1
reform https://pkg.go.dev/gopkg.in/reform.v1
dynamodbav https://docs.aws.amazon.com/sdk-for-go/api/service/dynamodb/dynamodbattribute/#Marshal
bigquery https://pkg.go.dev/cloud.google.com/go/bigquery
datastore https://pkg.go.dev/cloud.google.com/go/datastore
spanner https://pkg.go.dev/cloud.google.com/go/spanner
bson https://pkg.go.dev/go.mongodb.org/mongo-driver/bson
gorm https://pkg.go.dev/github.com/jinzhu/gorm
yaml https://pkg.go.dev/gopkg.in/yaml.v2
toml https://pkg.go.dev/github.com/pelletier/go-toml
validate https://github.com/go-playground/validator
mapstructure https://pkg.go.dev/github.com/mitchellh/mapstructure
parser https://pkg.go.dev/github.com/alecthomas/participle
protobuf https://github.com/golang/protobuf
db https://github.com/jmoiron/sqlx
url https://github.com/google/go-querystring
feature https://github.com/nikolaydubina/go-featureprocessing
graphql https://github.com/samsarahq/thunder
egg https://github.com/andrewwphillips/eggql
cue https://pkg.go.dev/cuelang.org/go/cuego

此內容屬於 Go Wiki 的一部分。