!97 一些优化

* refactor: 重构表格分页组件,适配大数据量分页
* fix:定时任务修复
* feat: gaussdb单独提出来
This commit is contained in:
zongyangleo
2024-01-30 13:09:26 +00:00
committed by Coder慌
parent d0b71a1c40
commit fc1b9ef35d
12 changed files with 183 additions and 61 deletions

View File

@@ -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)
}