From 134b86e22c5b7a471e8727b5a7605f4b5dfd89c9 Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Thu, 21 Dec 2023 13:30:30 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20RawMulti?= =?UTF-8?q?pleSQL()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- postgres_gorm/postgres_gorm.go | 4 ++-- postgres_gorm/postgres_gorm_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/postgres_gorm/postgres_gorm.go b/postgres_gorm/postgres_gorm.go index 3e69a387..24aa431e 100644 --- a/postgres_gorm/postgres_gorm.go +++ b/postgres_gorm/postgres_gorm.go @@ -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 } diff --git a/postgres_gorm/postgres_gorm_test.go b/postgres_gorm/postgres_gorm_test.go index 05663bfa..ba4b6f06 100644 --- a/postgres_gorm/postgres_gorm_test.go +++ b/postgres_gorm/postgres_gorm_test.go @@ -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) }