mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
rename mysql driver from 'mysql' to 'gf-mysql' to avoid multiple imports error
This commit is contained in:
@ -10,7 +10,7 @@ package gdb
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/gf-third/mysql"
|
||||
_ "github.com/gf-third/mysql"
|
||||
)
|
||||
|
||||
// 数据库链接对象
|
||||
@ -20,7 +20,6 @@ type dbMysql struct {
|
||||
|
||||
// 创建SQL操作对象,内部采用了lazy link处理
|
||||
func (db *dbMysql) Open (config *ConfigNode) (*sql.DB, error) {
|
||||
mysql.Register()
|
||||
var source string
|
||||
if config.LinkInfo != "" {
|
||||
source = config.LinkInfo
|
||||
@ -28,7 +27,7 @@ func (db *dbMysql) Open (config *ConfigNode) (*sql.DB, error) {
|
||||
source = fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=%s&multiStatements=true",
|
||||
config.User, config.Pass, config.Host, config.Port, config.Name, config.Charset)
|
||||
}
|
||||
if db, err := sql.Open("mysql", source); err == nil {
|
||||
if db, err := sql.Open("gf-mysql", source); err == nil {
|
||||
return db, nil
|
||||
} else {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user