StructsGo 结构体实用工具
Structs 包括各种 Go(Golang)结构实用工具。Structs 一开始只是用来转换一个结构体成为一个map[string]interface{},后来慢慢发展,现在添加了其他的实用工具。
安装
go get github.com/fatih/structs
使用和示例
定义和声明结构体:
type Server struct {
Name string `json:"name,omitempty"`
ID int
Enabled bool
users []string // not exported
http.Server // embedded}server := &Server{
Name: "gopher",
ID: 123456,
Enabled: true,}
评论
