refactor: 数据库meta使用注册方式,方便可插拔

This commit is contained in:
meilin.huang
2024-01-24 17:01:17 +08:00
parent bed95254d0
commit 7e9a381641
14 changed files with 55 additions and 99 deletions

View File

@@ -9,22 +9,13 @@ import (
"mayfly-go/pkg/utils/netx"
"net"
"strings"
"sync"
"time"
pq "gitee.com/liuzongyang/libpq"
)
var (
meta dbi.Meta
once sync.Once
)
func GetMeta() dbi.Meta {
once.Do(func() {
meta = new(PostgresMeta)
})
return meta
func init() {
dbi.Register(dbi.DbTypePostgres, new(PostgresMeta))
}
type PostgresMeta struct {