mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-06 06:35:47 +08:00
refactor: 数据库meta使用注册方式,方便可插拔
This commit is contained in:
@@ -6,21 +6,14 @@ import (
|
||||
"fmt"
|
||||
"mayfly-go/internal/db/dbm/dbi"
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
"github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
var (
|
||||
meta dbi.Meta
|
||||
once sync.Once
|
||||
)
|
||||
|
||||
func GetMeta() dbi.Meta {
|
||||
once.Do(func() {
|
||||
meta = new(MysqlMeta)
|
||||
})
|
||||
return meta
|
||||
func init() {
|
||||
meta := new(MysqlMeta)
|
||||
dbi.Register(dbi.DbTypeMysql, meta)
|
||||
dbi.Register(dbi.DbTypeMariadb, meta)
|
||||
}
|
||||
|
||||
type MysqlMeta struct {
|
||||
|
||||
Reference in New Issue
Block a user