add: update export table task

This commit is contained in:
2024-09-06 14:58:02 +08:00
parent 83cd5fbd58
commit 13b322a038
5 changed files with 16 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package dborm
import (
"database/sql"
"fmt"
"log"
"os"
@@ -85,11 +86,16 @@ func Close() {
}
}
// 获取默认数据源
// default gorm DB
func DefaultDB() *gorm.DB {
return dbgEngine
}
// get sql DB
func GCoreDB() (*sql.DB, error) {
return dbgEngine.DB()
}
// RawSQL 原生查询语句
func RawSQL(sql string, parameters []any) ([]map[string]any, error) {
// 数据源

View File

@@ -16,6 +16,7 @@ import (
_ "github.com/go-sql-driver/mysql"
"xorm.io/xorm"
"xorm.io/xorm/core"
)
const (
@@ -124,6 +125,10 @@ func XormConnectDatabase(dbType, dbUser, dbPassword, dbHost, dbPort, dbName stri
return xEngine, nil
}
func XCoreDB() *core.DB {
return xEngine.DB()
}
func ConstructInsertSQL(tableName string, insertData interface{}) (string, []string) {
log.Debug("ConstructInsertSQL processing... ")
log.Debug("Request insertData:", insertData)