Skip to content

Instantly share code, notes, and snippets.

@TrinhTrungDung
Created March 20, 2020 12:16
Show Gist options
  • Save TrinhTrungDung/c7170d9f42aafe0b48878a67982a270a to your computer and use it in GitHub Desktop.
Save TrinhTrungDung/c7170d9f42aafe0b48878a67982a270a to your computer and use it in GitHub Desktop.
Test benchmark for ORM create
func BenchmarkOrmCreate(b *testing.B) {
db, err := gorm.Open("postgres", "host=localhost port=5432 user=testuser dbname=testdb password=123456 sslmode=disable")
if err != nil {
fmt.Println(err)
}
defer db.Close()
users := stubUsers(b)
for _, user := range users {
db.Create(user)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment