chore[test]: Add benchmark for scan

This commit is contained in:
Melbex De Leon 2022-05-30 22:46:36 +08:00
parent 90cceca6e7
commit 153d0b76b2
No known key found for this signature in database
GPG Key ID: 9A664266F44E5B74

View File

@ -24,6 +24,16 @@ func BenchmarkFind(b *testing.B) {
}
}
func BenchmarkScan(b *testing.B) {
user := *GetUser("find", Config{})
DB.Create(&user)
var u User
for x := 0; x < b.N; x++ {
DB.Raw("select * from users where id = ?", user.ID).Scan(&u)
}
}
func BenchmarkUpdate(b *testing.B) {
user := *GetUser("find", Config{})
DB.Create(&user)