引用logger错误改log
This commit is contained in:
@@ -20,8 +20,8 @@ func RawDB(source string, sql string, parameters []any) ([]map[string]any, error
|
||||
// 使用正则表达式替换连续的空白字符为单个空格
|
||||
fmtSql := regexp.MustCompile(`\s+`).ReplaceAllString(sql, " ")
|
||||
|
||||
// logger.Infof("sql=> %v", fmtSql)
|
||||
// logger.Infof("parameters=> %v", parameters)
|
||||
// log.Infof("sql=> %v", fmtSql)
|
||||
// log.Infof("parameters=> %v", parameters)
|
||||
|
||||
// 查询结果
|
||||
var rows []map[string]any
|
||||
@@ -40,7 +40,7 @@ func ExecDB(source string, sql string, parameters []any) (int64, error) {
|
||||
// 使用正则表达式替换连续的空白字符为单个空格
|
||||
fmtSql := regexp.MustCompile(`\s+`).ReplaceAllString(sql, " ")
|
||||
// 执行结果
|
||||
res, err := db.Exec(fmtSql, parameters)
|
||||
res, err := db.Exec(append([]any{fmtSql}, parameters...)...)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user