aboutsummaryrefslogtreecommitdiff
path: root/benchmark/benchmark_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/benchmark_test.go')
-rw-r--r--benchmark/benchmark_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/benchmark/benchmark_test.go b/benchmark/benchmark_test.go
index 356d188..e0822f2 100644
--- a/benchmark/benchmark_test.go
+++ b/benchmark/benchmark_test.go
@@ -49,16 +49,19 @@ func BenchmarkSelect(b *testing.B) {
for _, selectedRecordCount := range []int{1, 10, 100, 1000} {
b.Run("N="+strconv.Itoa(selectedRecordCount), func(b *testing.B) {
// prepare the functions that will be benched
- odb := oblast.NewDB(db, oblast.SqliteDialect())
- gdb := gorp.DbMap{Db: db, Dialect: gorp.SqliteDialect{}}
type record struct {
ID int `db:"id"`
Message string `db:"message"`
}
+ store, err := oblast.NewStore[record](oblast.SqliteDialect())
+ if err != nil {
+ b.Fatal(err)
+ }
+ gdb := gorp.DbMap{Db: db, Dialect: gorp.SqliteDialect{}}
query := `SELECT * FROM entries WHERE id < ` + strconv.Itoa(selectedRecordCount) //nolint:gosec
selectWithOblast := func(b *testing.B) {
- records, err := oblast.Select[record](odb, query)
+ records, err := store.Select(db, query)
if err != nil {
b.Error(err)
}