03 2021 档案

摘要:func main() { count := 0 wg := sync.WaitGroup{} wg.Add(10) for i := 0; i < 10; i++ { go func() { defer wg.Done() for j := 0; j < 100000; j++ { count++ 阅读全文
posted @ 2021-03-30 09:49 hubb 阅读(169) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "time" ) func main(){ Go(func(){ fmt.Println("hello") panic("一路向北") }) time.Sleep(5 * time.Second) } func Go(x func()){ go 阅读全文
posted @ 2021-03-30 09:47 hubb 阅读(165) 评论(0) 推荐(0) 编辑
摘要:xorm 查询定义结构体Img []string `xorm:"img" json:"img"` 查询所有 invalid character 'è' looking for beginning of value 数据库 img 格式不一致造成 ["http://www.baidu.png","ht 阅读全文
posted @ 2021-03-26 11:46 hubb 阅读(927) 评论(0) 推荐(0) 编辑
摘要:什么是RPC 远程过程调用(Remote Procedure Call,缩写为 RPC)是一个计算机通信协议。 该协议允许运行于一台计算机的程序调用另一台计算机的子程序,而程序员无需额外地为这个交互作用编程。 如果涉及的软件采用面向对象编程,那么远程过程调用亦可称作远程调用或远程方法调用。维基百科: 阅读全文
posted @ 2021-03-25 17:23 hubb 阅读(217) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" ) func fibol(c,quit chan int){ x,y := 1,1 for{ select{ case c <- x: x = y y = x+y case <- quit: fmt.Println("quit") return 阅读全文
posted @ 2021-03-25 15:48 hubb 阅读(143) 评论(0) 推荐(0) 编辑
摘要:我们在写代码的时候,有时候会想这个变量到底分配到哪里了?这时候可能会有人说,在栈上,在堆上。信我准没错… 但从结果上来讲你还是一知半解,这可不行,万一被人懵了呢。今天我们一起来深挖下 Go 在这块的奥妙,自己动手丰衣足食 问题 type User struct { ID int64 Name str 阅读全文
posted @ 2021-03-25 15:42 hubb 阅读(31) 评论(0) 推荐(0) 编辑
摘要:package mainimport ( "fmt" "reflect" )type resume struct { Name string `info:"name" doc:"我的名字"` Sex string `info:"Sex"`}func findTag(str interface{}) 阅读全文
posted @ 2021-03-18 08:47 hubb 阅读(261) 评论(0) 推荐(0) 编辑
摘要:go 项目的版本是 1.13.14 docker 服务的go 版本 1.15 版本不一致造成 代码修改 由 func SetCtXXXXX(ctx context.Context) context.Context { ctx = context.WithValue(ctx, XXXX, XX) ct 阅读全文
posted @ 2021-03-16 11:14 hubb 阅读(372) 评论(0) 推荐(0) 编辑
摘要:$params = $request->input('params'); $params = null isJson Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']);查看header 头Content-Type: ap 阅读全文
posted @ 2021-03-16 11:10 hubb 阅读(336) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示