1
0
mirror of https://github.com/ManyakRus/starter.git synced 2025-11-28 23:20:10 +02:00

сделал RawMultipleSQL()

This commit is contained in:
Nikitin Aleksandr
2023-12-21 13:30:30 +03:00
parent 8c18623933
commit 134b86e22c
2 changed files with 4 additions and 3 deletions

View File

@@ -384,7 +384,7 @@ loop:
}
// RawMultipleSQL - выполняет текст запроса, отдельно для каждого запроса
func RawMultipleSQL(db *gorm.DB, TextSQL string) (*gorm.DB, error) {
func RawMultipleSQL(db *gorm.DB, TextSQL string) *gorm.DB {
var tx *gorm.DB
var err error
@@ -410,5 +410,5 @@ func RawMultipleSQL(db *gorm.DB, TextSQL string) (*gorm.DB, error) {
log.Panic("db.Raw() error: rows =nil")
}
return tx, err
return tx
}

View File

@@ -126,7 +126,8 @@ func TestRawMultipleSQL(t *testing.T) {
defer CloseConnection()
TextSQL := "SELECT 1; SELECT 2"
_, err := RawMultipleSQL(Conn, TextSQL)
tx := RawMultipleSQL(Conn, TextSQL)
err := tx.Error
if err != nil {
t.Error("TestRawMultipleSQL() error: ", err)
}