Explorar el Código

修复执行sql代码bugp

qdy hace 3 meses
padre
commit
2b3bb3febe
Se han modificado 2 ficheros con 3 adiciones y 3 borrados
  1. 2
    2
      factory/db_factory.go
  2. 1
    1
      functions/query_csv.go

+ 2
- 2
factory/db_factory.go Ver fichero

@@ -118,7 +118,7 @@ func (f *DBFactory) QueryToJSON(sql string) *types.QueryResult {
118 118
 }
119 119
 
120 120
 // QueryParamsToJSON 位置参数查询并返回 JSON 字节数据
121
-func (f *DBFactory) QueryPositionalToJSON(sql string, params []interface{}) *types.QueryResult {
121
+func (f *DBFactory) QueryPositionalToJSON(sql string, params ...interface{}) *types.QueryResult {
122 122
 
123 123
 	return functions.QueryPositionalToJSON(f.db, sql, params)
124 124
 }
@@ -136,7 +136,7 @@ func (f *DBFactory) QueryToCSV(sql string) ([]byte, error) {
136 136
 }
137 137
 
138 138
 // QueryParamsToCSV 位置参数查询并返回 CSV 字节数据
139
-func (f *DBFactory) QueryPositionalToCSV(sql string, params []interface{}) ([]byte, error) {
139
+func (f *DBFactory) QueryPositionalToCSV(sql string, params ...interface{}) ([]byte, error) {
140 140
 
141 141
 	return functions.QueryPositionalToCSV(f.db, sql, params)
142 142
 }

+ 1
- 1
functions/query_csv.go Ver fichero

@@ -24,7 +24,7 @@ func QueryToCSV(db *sqlx.DB, sql string) ([]byte, error) {
24 24
 }
25 25
 
26 26
 // QueryParamsToCSV 位置参数查询并返回 CSV 字节数据
27
-func QueryPositionalToCSV(db *sqlx.DB, sql string, positionalParams []interface{}) ([]byte, error) {
27
+func QueryPositionalToCSV(db *sqlx.DB, sql string, positionalParams ...interface{}) ([]byte, error) {
28 28
 	if sql == "" {
29 29
 		return nil, fmt.Errorf("SQL query cannot be empty")
30 30
 	}

Loading…
Cancelar
Guardar