随笔分类 - golang
摘要:package lottery import ( "fmt" "math/rand" "sort" "time" ) type Lottery struct { } func NewLottery() *Lottery { return &Lottery{} } type Prize struct
阅读全文
摘要:package school import "fmt" func init() { fmt.Println("school包初始化了") } type School struct { } func (s *School) PrintSchool() { fmt.Println("我是一所学校") }
阅读全文
摘要:第一种方式: 使用json包 package main import ( "encoding/json" "fmt" "reflect" ) func main() { type User struct { Id int64 `json:"Id"` Name string `json:"Name"`
阅读全文