
go
go语言
ShellDawn
Gu-Ah
展开
-
Go的一些总结
go原创 2020-10-09 21:24:32 · 206 阅读 · 0 评论 -
Go: pprof与性能分析
pprof是非常好用的性能分析工具 对于服务类型,需要在main文件中加入: import _ "net/http/pprof" func main(){ go func(){ http.ListenAndServe("0.0.0.0:8899",nil) }() } 在服务运行后,来分析数据: go tool pprof -inuse_space http://your_ip:8899/debug/pprof/heap 进入命令交互洁面,top查看占用比: top 图片分析更直观: go原创 2020-09-02 21:28:32 · 268 阅读 · 0 评论 -
go:自定义结构体排序,结构体二级排序
go 的自定义排序 type entity struct{ Id int64 UserLongtitude float64 UserLatitude float64 Longitude float64 Latitude float64 } type list []*entity func (s list) Len() int { return len(s) } func (s list) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s li原创 2020-07-02 15:22:40 · 678 阅读 · 0 评论 -
go:gorm包
GORM中文文档http://gorm.book.jasperxu.com/ 操作一张表,一般对应一个model包下的struct,总结几条规则: type Animal struct { AnimalId int64 `gorm:"primary_key"` // 设置AnimalId为主键 AgeTime int64 // 自动对应表中age...原创 2020-01-15 17:38:02 · 732 阅读 · 0 评论