Browse Source

update mysql driver version

master
han2015 6 months ago
parent
commit
2f95bdcc87
  1. 1
      code/rest/install_controller.go
  2. 14
      code/support/tank_context.go
  3. 15
      go.mod
  4. 5
      go.sum

1
code/rest/install_controller.go

@ -113,6 +113,7 @@ func (this *InstallController) openDbConnection(writer http.ResponseWriter, requ
var err error = nil
db, err := gorm.Open("mysql", mysqlUrl)
this.PanicError(err)
db.LogMode(false)

14
code/support/tank_context.go

@ -1,12 +1,14 @@
package support
import (
"net/http"
"reflect"
"time"
"github.com/eyebluecn/tank/code/core"
"github.com/eyebluecn/tank/code/rest"
"github.com/eyebluecn/tank/code/tool/cache"
"github.com/jinzhu/gorm"
"net/http"
"reflect"
)
type TankContext struct {
@ -63,7 +65,7 @@ func (this *TankContext) Cleanup() {
}
}
//can serve as http server.
// can serve as http server.
func (this *TankContext) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
this.Router.ServeHTTP(writer, request)
}
@ -72,7 +74,9 @@ func (this *TankContext) OpenDb() {
var err error = nil
this.db, err = gorm.Open("mysql", core.CONFIG.MysqlUrl())
this.db.DB().SetMaxIdleConns(10)
this.db.DB().SetMaxOpenConns(200)
this.db.DB().SetConnMaxLifetime(time.Hour)
if err != nil {
core.LOGGER.Panic("failed to connect mysql database")
}
@ -203,7 +207,7 @@ func (this *TankContext) initBeans() {
}
}
//if application installed. invoke this method.
// if application installed. invoke this method.
func (this *TankContext) InstallOk() {
if core.CONFIG.Installed() {

15
go.mod

@ -1,13 +1,24 @@
module github.com/eyebluecn/tank
go 1.14
go 1.22.0
toolchain go1.24.2
require (
github.com/disintegration/imaging v1.6.2
github.com/go-sql-driver/mysql v1.5.0
github.com/go-sql-driver/mysql v1.9.3-0.20250508063858-af56fba75c83
github.com/jinzhu/gorm v1.9.14
github.com/json-iterator/go v1.1.10
github.com/robfig/cron/v3 v3.0.1
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/text v0.3.3
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
)

5
go.sum

@ -1,3 +1,5 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -9,8 +11,9 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.9.3-0.20250508063858-af56fba75c83 h1:a4Zcy40NuJFNiYJ2Dl3EzMTNX1KCKs59acbvP6J8vbI=
github.com/go-sql-driver/mysql v1.9.3-0.20250508063858-af56fba75c83/go.mod h1:TrDMWzjNTKvJeK2GC8uspG+PWyPLiY9QKvwdWpAdlZE=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=

Loading…
Cancel
Save