Skip to content

Commit

Permalink
Find before Updates is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
Magellan committed Oct 19, 2023
1 parent e5208c4 commit cbdd858
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module gorm.io/playground
go 1.20

require (
gorm.io/driver/mysql v1.5.1
gorm.io/driver/postgres v1.5.2
gorm.io/driver/sqlite v1.5.3
gorm.io/driver/sqlserver v1.5.1
gorm.io/gorm v1.25.4
gorm.io/driver/mysql v1.5.2
gorm.io/driver/postgres v1.5.3
gorm.io/driver/sqlite v1.5.4
gorm.io/driver/sqlserver v1.5.2
gorm.io/gorm v1.25.5
)

require (
Expand All @@ -20,9 +20,9 @@ require (
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/microsoft/go-mssqldb v1.5.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/text v0.12.0 // indirect
github.com/microsoft/go-mssqldb v1.6.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/text v0.13.0 // indirect
)

replace gorm.io/gorm => ./gorm
12 changes: 10 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ func TestGORM(t *testing.T) {

DB.Create(&user)

var result User
if err := DB.First(&result, user.ID).Error; err != nil {
var result []User
in := []string{user.Name}
err := DB.Model(&User{}).
Where("name IN ?", in).
Find(&result).
Updates(User{
Name: "oui",
}).
Error
if err != nil {
t.Errorf("Failed, got error: %v", err)
}
}

0 comments on commit cbdd858

Please sign in to comment.