[tool]anything to go struct / [工具]将字符串转为go的struct
anything to go struct
go get -u github.com/Chyroc/to-struct
cat ./testdata/map_1.json | ./to-struct
type Struct struct {
Code int
Count int
Result []struct {
Aid int
ArtistID int
Lrc string
Sid int
Song string
}
}
cat ./testdata/slice_1.json | ./to-struct
type Struct struct {
Slice []struct {
Aid int
ArtistID int
Lrc string
Sid int
Song string
}
}
cat cat ./testdata/toml_1.toml | ./to-struct
type Struct struct {
Clients struct {
Data [][]string
Hosts []string
}
Database struct {
ConnectionMax int64
Enabled bool
Ports []int64
Server string
}
Owner struct {
Dob time.Time
Name string
}
Servers struct {
Alpha struct {
Dc string
IP string
}
Beta struct {
Dc string
IP string
}
}
Title string
}