golang
已收录文章:12609篇
-
网上很多资源都说是xorm reverse mysql "root:123456@tcp(127.0.0.1:3306)/users?charset=utf8" ./ 执行后报错:2022/03/16 15:00:53 [Error] reverse.go:196 Unknown colType INT UNSIGNED 实际上原有的xorm 已经不能用了,现在162 收藏
-
使用channel实现协程池 通过 Channel 实现 Goroutine Pool,缺点是会造成协程的频繁开辟和注销,但好在简单灵活通用。 package main import ( "fmt" "io/ioutil" "net/http" "sync" ) // Pool goroutine Pool type Pool struct162 收藏
-
在go语言中,byte其实是uint8的别名,byte 和 uint8 之间可以直接进行互转。 目前来只能将0~255范围的int转成byte。 func Int64ToBytes(num int64) []uint8 { var buffer bytes.Buffer err := binary.Write(&buffer, binary.Big162 收藏
-
看代码吧~ //自定义结构体,用来自定义排序 type RecentlyUpdateListMapSorter []map[string]interface{} //根据MapSorter.Keys进行倒序排序 func (ms *RecentlyUpdateListMapSorter) SortReverse() { sort.Sort(sort.Reverse(ms)) } //自定义162 收藏
-
超时 建立连接 主要就2函数Dail和DialContext。 // Dial creates a client connection to the given target. func Dial(target string, opts ...DialOption) (*ClientConn, error) { return DialContext(context.Background(), target, opts...) } fun162 收藏
-
xorm支持各种关系数据库,最近使用postgresql时,总是踩到一些坑,在此记录下解决方式。 在使用postgresql的array类型时,查询有点问题,xorm的官方文档给出重写的方式,但是不是很清晰: 官方文162 收藏