mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-07 18:00:25 +08:00
!97 一些优化
* refactor: 重构表格分页组件,适配大数据量分页 * fix:定时任务修复 * feat: gaussdb单独提出来
This commit is contained in:
@@ -16,13 +16,18 @@ import (
|
||||
|
||||
func init() {
|
||||
dbi.Register(dbi.DbTypePostgres, new(PostgresMeta))
|
||||
|
||||
gauss := new(PostgresMeta)
|
||||
gauss.Param = "dbtype=gauss"
|
||||
dbi.Register(dbi.DbTypeGauss, gauss)
|
||||
}
|
||||
|
||||
type PostgresMeta struct {
|
||||
Param string
|
||||
}
|
||||
|
||||
func (md *PostgresMeta) GetSqlDb(d *dbi.DbInfo) (*sql.DB, error) {
|
||||
driverName := string(d.Type)
|
||||
driverName := "postgres"
|
||||
// SSH Conect
|
||||
if d.SshTunnelMachineId > 0 {
|
||||
// 如果使用了隧道,则使用`postgres:ssh:隧道机器id`注册名
|
||||
@@ -67,6 +72,10 @@ func (md *PostgresMeta) GetSqlDb(d *dbi.DbInfo) (*sql.DB, error) {
|
||||
dsn = fmt.Sprintf("%s %s", dsn, strings.Join(strings.Split(d.Params, "&"), " "))
|
||||
}
|
||||
|
||||
if md.Param != "" && !strings.Contains(dsn, "dbtype") {
|
||||
dsn = fmt.Sprintf("%s %s", dsn, md.Param)
|
||||
}
|
||||
|
||||
return sql.Open(driverName, dsn)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user