Skip to content

Commit 0a5395f

Browse files
committed
Compatible with the GORM generics version APIs
1 parent 4f2c3fe commit 0a5395f

File tree

3 files changed

+51
-102
lines changed

3 files changed

+51
-102
lines changed

create.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,18 @@ func Create(db *gorm.DB) {
123123
if db.AddError(err) == nil {
124124
defer rows.Close()
125125
gorm.Scan(rows, db, gorm.ScanUpdate|gorm.ScanOnConflictDoNothing)
126+
if db.Statement.Result != nil {
127+
db.Statement.Result.RowsAffected = db.RowsAffected
128+
}
126129
}
127130
} else {
128131
result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
129132
if db.AddError(err) == nil {
130133
db.RowsAffected, _ = result.RowsAffected()
134+
if db.Statement.Result != nil {
135+
db.Statement.Result.Result = result
136+
db.Statement.Result.RowsAffected = db.RowsAffected
137+
}
131138
}
132139
}
133140
}

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module gorm.io/driver/sqlserver
33
go 1.14
44

55
require (
6-
github.com/microsoft/go-mssqldb v1.8.0
7-
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
6+
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
7+
github.com/microsoft/go-mssqldb v0.19.0
8+
gorm.io/gorm v1.30.0
89
)

0 commit comments

Comments
 (0)