Skip to content

Commit

Permalink
Merge pull request #37 from djx30103/master
Browse files Browse the repository at this point in the history
docs(README): fix example code using incorrect Save method
  • Loading branch information
icpd authored Jul 15, 2024
2 parents 9293bbb + 01186a2 commit 63a60da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ DB.Model(&User{}).Where("id = 1").Update("age", 12)

// When want to use GORM's Save method, need to call Select. Otherwise, will return primary key duplicate error.
// The Select param is the fields that you want to update or "*".
DB.Model(&user).Select("*").Updates(&User{Age: 18})
DB.Model(&user).Select("*").Save(&User{Age: 18})
```

0 comments on commit 63a60da

Please sign in to comment.