mirror of
https://gitee.com/johng/gf
synced 2026-06-26 09:27:31 +08:00
26 lines
365 B
Go
26 lines
365 B
Go
package main
|
||
|
||
import (
|
||
"time"
|
||
|
||
"github.com/gogf/gf/frame/g"
|
||
)
|
||
|
||
func main() {
|
||
db := g.DB()
|
||
db.SetMaxIdleConnCount(10)
|
||
db.SetMaxOpenConnCount(10)
|
||
db.SetMaxConnLifetime(time.Minute)
|
||
|
||
// 开启调试模式,以便于记录所有执行的SQL
|
||
db.SetDebug(true)
|
||
|
||
for {
|
||
for i := 0; i < 10; i++ {
|
||
go db.Table("user").All()
|
||
}
|
||
time.Sleep(time.Second)
|
||
}
|
||
|
||
}
|