1
0
mirror of https://github.com/gogf/gf.git synced 2025-04-05 11:18:50 +08:00
gf/.example/database/gdb/mysql/gdb_reconnect.go
2021-10-11 21:41:56 +08:00

23 lines
307 B
Go

package main
import (
"fmt"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"time"
)
func main() {
var (
db = g.DB()
ctx = gctx.New()
)
db.SetDebug(true)
for {
r, err := db.Ctx(ctx).Model("user").All()
fmt.Println(err)
fmt.Println(r)
time.Sleep(time.Second * 10)
}
}