diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-04-11 20:19:12 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-04-11 20:20:03 +0200 |
| commit | e9d31443f01eda2ecee66dbc25f154a6949a9c97 (patch) | |
| tree | 1824c7dc3290e4d38ab111522938e8a33e2f9618 /benchmark/benchmark_test.go | |
| parent | 3d28ce0650fc85ca054a608bce32f88f2d90295f (diff) | |
| download | go-oblast-e9d31443f01eda2ecee66dbc25f154a6949a9c97.tar.gz | |
reorganize the API from type DB to type Store
Diffstat (limited to 'benchmark/benchmark_test.go')
| -rw-r--r-- | benchmark/benchmark_test.go | 9 |
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) } |
