Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for BenchmarkScan (0.14 sec)

  1. tests/benchmark_test.go

    	}
    }
    
    func BenchmarkFind(b *testing.B) {
    	user := *GetUser("find", Config{})
    	DB.Create(&user)
    
    	for x := 0; x < b.N; x++ {
    		DB.Find(&User{}, "id = ?", user.ID)
    	}
    }
    
    func BenchmarkScan(b *testing.B) {
    	user := *GetUser("scan", Config{})
    	DB.Create(&user)
    
    	var u User
    	b.ResetTimer()
    	for x := 0; x < b.N; x++ {
    		DB.Raw("select * from users where id = ?", user.ID).Scan(&u)
    	}
    }
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 01 03:50:57 UTC 2022
    - 1.5K bytes
    - Viewed (0)
Back to top