package main import ( "fmt" yaml "gopkg.in/yaml.v2" )
type Address struct { Street string`json:"street"` Number int`json:"number"` }
type School struct { Name string`json:"name"` Address Address `json:"address"` }
type Student struct { Id int`json:"id"` Name string`json:"name` Count *int`json:"count"`// 普通指针 School *School `json:"school"`// 对象指针 Addresses []Address `json:"addresses"`// 对象数组 }
package main import ( "fmt" yaml "gopkg.in/yaml.v2" )
type Address struct { Street string`json:"street"` Number int`json:"number"` }
type School struct { Name string`json:"name"` Address Address `json:"address"` }
type Student struct { Id int`json:"id"` Name string`json:"name` Count *int`json:"count"`// 普通指针 School *School `json:"school"`// 对象指针 Addresses []Address `json:"addresses"`// 对象数组 }