Add missing batch API (#325)

Some of gocql.Batch API are not present in the gocqlx.Batch.
We need to have them implemented and have a test to make sure no API has
forgotten.
This commit is contained in:
Dmitry Kropachev
2025-06-11 06:16:31 -04:00
committed by GitHub
parent d6db570d31
commit efee4798d6
3 changed files with 101 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
package gocqlx_test
import (
"reflect"
"testing"
"github.com/gocql/gocql"
@@ -189,3 +190,23 @@ func TestBatch(t *testing.T) {
}
})
}
func TestBatchAllWrapped(t *testing.T) {
var (
gocqlType = reflect.TypeOf((*gocql.Batch)(nil))
gocqlxType = reflect.TypeOf((*gocqlx.Batch)(nil))
)
for i := 0; i < gocqlType.NumMethod(); i++ {
m, ok := gocqlxType.MethodByName(gocqlType.Method(i).Name)
if !ok {
t.Fatalf("Batch missing method %s", gocqlType.Method(i).Name)
}
for j := 0; j < m.Type.NumOut(); j++ {
if m.Type.Out(j) == gocqlType {
t.Errorf("Batch method %s not wrapped", m.Name)
}
}
}
}