Files
gf/database/gdb/gdb_driver_default.go

47 lines
1.3 KiB
Go
Raw Permalink Normal View History

2022-05-10 16:31:56 +08:00
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gdb
import (
"database/sql"
)
2022-09-26 22:11:13 +08:00
// DriverDefault is the default driver for mysql database, which does nothing.
type DriverDefault struct {
2022-05-10 16:31:56 +08:00
*Core
}
func init() {
2022-09-26 22:11:13 +08:00
if err := Register("default", &DriverDefault{}); err != nil {
2022-05-10 16:31:56 +08:00
panic(err)
}
}
// New creates and returns a database object for mysql.
// It implements the interface of gdb.Driver for extra database driver installation.
2022-09-26 22:11:13 +08:00
func (d *DriverDefault) New(core *Core, node *ConfigNode) (DB, error) {
return &DriverDefault{
2022-05-10 16:31:56 +08:00
Core: core,
}, nil
}
// Open creates and returns an underlying sql.DB object for mysql.
// Note that it converts time.Time argument to local timezone in default.
2022-09-26 22:11:13 +08:00
func (d *DriverDefault) Open(config *ConfigNode) (db *sql.DB, err error) {
2022-05-10 16:31:56 +08:00
return
}
// PingMaster pings the master node to check authentication or keeps the connection alive.
2022-09-26 22:11:13 +08:00
func (d *DriverDefault) PingMaster() error {
2022-05-10 16:31:56 +08:00
return nil
}
// PingSlave pings the slave node to check authentication or keeps the connection alive.
2022-09-26 22:11:13 +08:00
func (d *DriverDefault) PingSlave() error {
2022-05-10 16:31:56 +08:00
return nil
}