随笔分类 -  golang

摘要:package lottery import ( "fmt" "math/rand" "sort" "time" ) type Lottery struct { } func NewLottery() *Lottery { return &Lottery{} } type Prize struct 阅读全文
posted @ 2024-11-15 15:44 今天滴天气不错 阅读(52) 评论(0) 推荐(0)
摘要:package school import "fmt" func init() { fmt.Println("school包初始化了") } type School struct { } func (s *School) PrintSchool() { fmt.Println("我是一所学校") } 阅读全文
posted @ 2024-11-09 14:27 今天滴天气不错 阅读(8) 评论(0) 推荐(0)
摘要:第一种方式: 使用json包 package main import ( "encoding/json" "fmt" "reflect" ) func main() { type User struct { Id int64 `json:"Id"` Name string `json:"Name"` 阅读全文
posted @ 2022-07-24 10:52 今天滴天气不错 阅读(534) 评论(0) 推荐(0)