随笔分类 -  golang

摘要:... 函数式选项模式的使用场景有哪些呢:我们一般用来配置一些基础的服务配置,比如MySQL,Redis,Kafka的配置,很多可选参数,可以方便动态灵活的配置想要配置的参数。 https://zhuanlan.zhihu.com/p/436468481 type Option func(*User 阅读全文
posted @ 2023-03-01 10:23 voh99800 阅读(55) 评论(0) 推荐(0) 编辑
摘要:... package main import ( "fmt" "log" "time" "github.com/go-rod/rod" "github.com/go-rod/rod/lib/launcher" ) type TbPars struct { NavUrl string // firs 阅读全文
posted @ 2022-01-08 01:33 voh99800 阅读(521) 评论(0) 推荐(0) 编辑
摘要:... 初始化匿名成员为接口的结构体,初始化参数需要是指针,ide帮忙解决了,结构体,可以直接调用初始化参数实现的方法,也就是接口内的方法 package main import "log" type Bird interface { Biss() } type Lan struct{} func 阅读全文
posted @ 2021-12-30 16:51 voh99800 阅读(31) 评论(0) 推荐(0) 编辑
摘要:... 使用mysql 客户端的正确姿势,解决一堆 3306 time_wait的问题 package dbs import ( "database/sql" "fmt" "log" "time" _ "github.com/go-sql-driver/mysql" ) var MysqlDb *s 阅读全文
posted @ 2021-10-14 14:48 voh99800 阅读(207) 评论(0) 推荐(0) 编辑
摘要:如果类不用于继承, python用类干嘛 如果不懂接口, 用golang 干嘛, 接口,并发都是相关的 阅读全文
posted @ 2021-09-13 14:32 voh99800 阅读(23) 评论(0) 推荐(0) 编辑
摘要:from https://www.cnblogs.com/janbar/archive/2021/04/01/14607659.html 文章非常棒,无废话干货 package main import ( "flag" "fmt" "net/http" "golang.org/x/crypto/bc 阅读全文
posted @ 2021-08-17 11:31 voh99800 阅读(143) 评论(0) 推荐(0) 编辑
摘要:package main import ( "log" "testing" "github.com/ghodss/yaml" ) func TestApp(t *testing.T) { by := []byte(`settings: application: # dev开发环境 test测试环境 阅读全文
posted @ 2021-06-08 21:38 voh99800 阅读(87) 评论(0) 推荐(0) 编辑
摘要:...占位 1, 例子理解 // from https://blog.csdn.net/u011957758/article/details/82948750 package main import ( "context" "fmt" "math/rand" "time" ) /* 1, main 阅读全文
posted @ 2021-05-18 15:15 voh99800 阅读(60) 评论(0) 推荐(0) 编辑
摘要:...func init 一个笔记链接 https://cyent.github.io/golang/method/interface_oo/一个接口展示链接https://blog.csdn.net/weixin_34204722/article/details/91929123 package 阅读全文
posted @ 2021-02-06 23:10 voh99800 阅读(67) 评论(0) 推荐(0) 编辑
摘要:package main import ( "context" "fmt" "time" ) func timeoutHandler() { // 创建继承Background的子节点Context ctx, cancel := context.WithTimeout(context.Backgro 阅读全文
posted @ 2021-01-06 16:27 voh99800 阅读(92) 评论(0) 推荐(0) 编辑
摘要:and or 判断数组为空 rd:=bson.M{"num":"1","$or":[]bson.M{{"$where":"this.logo.length>0"},{"$where":"this.ziliao.length>0"}}} mongo-go-driver: nested OR/AND q 阅读全文
posted @ 2020-12-01 19:07 voh99800 阅读(305) 评论(0) 推荐(0) 编辑
摘要:usefull urls https://blog.csdn.net/weixin_46124208/article/details/108483355 > db.sales.find(){ "_id" : ObjectId("77f02ee61df85c423b6a4e79"), "client" 阅读全文
posted @ 2020-11-04 14:53 voh99800 阅读(1952) 评论(0) 推荐(0) 编辑
摘要:....占位 copy from https://www.jianshu.com/p/10c857270947 https://www.jianshu.com/p/55b0b8126e40?utm_campaign=studygolang.com&utm_medium=studygolang.com 阅读全文
posted @ 2020-10-26 01:38 voh99800 阅读(1544) 评论(0) 推荐(0) 编辑
摘要:1, 占位 type func interface 范式 type myFunc func(int) int func (f myFunc) sum (a, b int) int { res := a + b return f(res) } func sum10(num int) int { ret 阅读全文
posted @ 2020-05-26 20:24 voh99800 阅读(219) 评论(0) 推荐(0) 编辑

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