support database postgresql and tidb

This commit is contained in:
zhuyasen
2024-02-08 16:35:33 +08:00
parent 948b3f0b36
commit a56a20263a
83 changed files with 2050 additions and 725 deletions

View File

@@ -7,11 +7,11 @@ import (
_ "github.com/go-sql-driver/mysql" //nolint
)
// GetTableInfo get table info from mysql
func GetTableInfo(dsn, tableName string) (string, error) {
// GetMysqlTableInfo get table info from mysql
func GetMysqlTableInfo(dsn, tableName string) (string, error) {
db, err := sql.Open("mysql", dsn)
if err != nil {
return "", fmt.Errorf("connect mysql error, %v", err)
return "", fmt.Errorf("GetMysqlTableInfo error, %v", err)
}
defer db.Close() //nolint
@@ -34,3 +34,9 @@ func GetTableInfo(dsn, tableName string) (string, error) {
return info, nil
}
// GetTableInfo get table info from mysql
// Deprecated: replaced by GetMysqlTableInfo
func GetTableInfo(dsn, tableName string) (string, error) {
return GetMysqlTableInfo(dsn, tableName)
}