Fix panic in tests in queryx_bench_test.go (#339)

This panic cause by Queryx struct having no Mapper and no gocql.Query in
it.
This commit is contained in:
Dmitry Kropachev
2025-09-03 06:57:07 -04:00
committed by GitHub
parent 19efa3f52f
commit e6a1f70adc

View File

@@ -7,6 +7,8 @@ package gocqlx_test
import ( import (
"testing" "testing"
"github.com/gocql/gocql"
"github.com/scylladb/gocqlx/v3" "github.com/scylladb/gocqlx/v3"
) )
@@ -21,6 +23,8 @@ func BenchmarkCompileNamedQuery(b *testing.B) {
func BenchmarkQueryxBindStruct(b *testing.B) { func BenchmarkQueryxBindStruct(b *testing.B) {
q := gocqlx.Queryx{ q := gocqlx.Queryx{
Names: []string{"name", "age", "first", "last"}, Names: []string{"name", "age", "first", "last"},
Mapper: gocqlx.DefaultMapper,
Query: &gocql.Query{},
} }
type t struct { type t struct {
Name string Name string
@@ -38,6 +42,8 @@ func BenchmarkQueryxBindStruct(b *testing.B) {
func BenchmarkBindMap(b *testing.B) { func BenchmarkBindMap(b *testing.B) {
q := gocqlx.Queryx{ q := gocqlx.Queryx{
Names: []string{"name", "age", "first", "last"}, Names: []string{"name", "age", "first", "last"},
Mapper: gocqlx.DefaultMapper,
Query: &gocql.Query{},
} }
am := map[string]interface{}{ am := map[string]interface{}{
"name": "Jason Moiron", "name": "Jason Moiron",