Help us shape the future of Go! Take the 2026 Go Developer Survey

validation

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package validation is a driver-agnostic test suite intended to aid in driver development for ADBC drivers. It provides a series of utilities and defined tests that can be used to validate a driver follows the correct and expected behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckedCleanup added in v1.6.0

func CheckedCleanup(t *testing.T, c func() error)

CheckedClose is a helper for deferring a function with a potential error in a test. For example: `defer CheckedCleanup(suite.T(), func() error { return os.Remove(path) })`

func CheckedClose added in v1.6.0

func CheckedClose(t *testing.T, c io.Closer)

CheckedClose is a helper for deferring Close() with a potential error in a test. For example: `defer CheckedClose(suite.T(), stmt)`

Types

type ConnectionTests

type ConnectionTests struct {
	suite.Suite

	Driver adbc.Driver
	Quirks DriverQuirks

	DB adbc.Database
}

func (*ConnectionTests) SetupTest

func (c *ConnectionTests) SetupTest()

func (*ConnectionTests) TearDownTest

func (c *ConnectionTests) TearDownTest()

func (*ConnectionTests) TestAutocommitDefault

func (c *ConnectionTests) TestAutocommitDefault()

func (*ConnectionTests) TestAutocommitToggle

func (c *ConnectionTests) TestAutocommitToggle()

func (*ConnectionTests) TestCloseConnTwice

func (c *ConnectionTests) TestCloseConnTwice()

func (*ConnectionTests) TestConcurrent

func (c *ConnectionTests) TestConcurrent()

func (*ConnectionTests) TestGetSetOptions added in v0.7.0

func (c *ConnectionTests) TestGetSetOptions()

func (*ConnectionTests) TestMetadataCurrentCatalog added in v0.7.0

func (c *ConnectionTests) TestMetadataCurrentCatalog()

func (*ConnectionTests) TestMetadataCurrentDbSchema added in v0.7.0

func (c *ConnectionTests) TestMetadataCurrentDbSchema()

func (*ConnectionTests) TestMetadataGetInfo

func (c *ConnectionTests) TestMetadataGetInfo()

func (*ConnectionTests) TestMetadataGetObjectsColumns added in v0.4.0

func (c *ConnectionTests) TestMetadataGetObjectsColumns()

func (*ConnectionTests) TestMetadataGetStatistics added in v0.7.0

func (c *ConnectionTests) TestMetadataGetStatistics()

func (*ConnectionTests) TestMetadataGetTableSchema

func (c *ConnectionTests) TestMetadataGetTableSchema()

func (*ConnectionTests) TestMetadataGetTableTypes

func (c *ConnectionTests) TestMetadataGetTableTypes()

func (*ConnectionTests) TestNewConn

func (c *ConnectionTests) TestNewConn()

type DatabaseTests

type DatabaseTests struct {
	suite.Suite

	Driver adbc.Driver
	Quirks DriverQuirks
}

func (*DatabaseTests) SetupTest

func (d *DatabaseTests) SetupTest()

func (*DatabaseTests) TearDownTest

func (d *DatabaseTests) TearDownTest()

func (*DatabaseTests) TestNewDatabase

func (d *DatabaseTests) TestNewDatabase()

type DriverQuirks

type DriverQuirks interface {
	// Called in SetupTest to initialize anything needed for testing
	SetupDriver(*testing.T) adbc.Driver
	// Called in TearDownTest to clean up anything necessary in between tests
	TearDownDriver(*testing.T, adbc.Driver)
	// Return the list of key/value pairs of options to pass when
	// calling NewDatabase
	DatabaseOptions() map[string]string
	// Return the SQL to reference the bind parameter for a given index
	BindParameter(index int) string
	// Whether the driver supports bulk ingest
	SupportsBulkIngest(mode string) bool
	// Whether two statements can be used at the same time on a single connection
	SupportsConcurrentStatements() bool
	// Whether current catalog/schema are supported
	SupportsCurrentCatalogSchema() bool
	// Whether GetSetOptions is supported
	SupportsGetSetOptions() bool
	// Whether AdbcStatementExecuteSchema should work
	SupportsExecuteSchema() bool
	// Whether AdbcStatementExecutePartitions should work
	SupportsPartitionedData() bool
	// Whether statistics are supported
	SupportsStatistics() bool
	// Whether transactions are supported (Commit/Rollback on connection)
	SupportsTransactions() bool
	// Whether retrieving the schema of prepared statement params is supported
	SupportsGetParameterSchema() bool
	// Whether it supports dynamic parameter binding in queries
	SupportsDynamicParameterBinding() bool
	// Whether it returns an error when attempting to ingest with an incompatible schema
	SupportsErrorIngestIncompatibleSchema() bool
	// Expected Metadata responses
	GetMetadata(adbc.InfoCode) interface{}
	// Create a sample table from an arrow record
	CreateSampleTable(tableName string, r arrow.RecordBatch) error
	// Field Metadata for Sample Table for comparison
	SampleTableSchemaMetadata(tblName string, dt arrow.DataType) arrow.Metadata
	// have the driver drop a table with the correct SQL syntax
	DropTable(adbc.Connection, string) error

	Catalog() string
	DBSchema() string

	Alloc() memory.Allocator
}

type StatementTests

type StatementTests struct {
	suite.Suite

	Driver adbc.Driver
	Quirks DriverQuirks

	DB   adbc.Database
	Cnxn adbc.Connection
	// contains filtered or unexported fields
}

func (*StatementTests) SetupTest

func (s *StatementTests) SetupTest()

func (*StatementTests) TearDownTest

func (s *StatementTests) TearDownTest()

func (*StatementTests) TestNewStatement

func (s *StatementTests) TestNewStatement()

func (*StatementTests) TestSQLPrepareGetParameterSchema

func (s *StatementTests) TestSQLPrepareGetParameterSchema()

func (*StatementTests) TestSQLPrepareSelectNoParams

func (s *StatementTests) TestSQLPrepareSelectNoParams()

func (*StatementTests) TestSQLPrepareSelectParams

func (s *StatementTests) TestSQLPrepareSelectParams()

func (*StatementTests) TestSqlExecuteSchema added in v0.7.0

func (s *StatementTests) TestSqlExecuteSchema()

func (*StatementTests) TestSqlIngestAppend added in v0.4.0

func (s *StatementTests) TestSqlIngestAppend()

func (*StatementTests) TestSqlIngestCreateAppend added in v0.7.0

func (s *StatementTests) TestSqlIngestCreateAppend()

func (*StatementTests) TestSqlIngestErrors added in v0.4.0

func (s *StatementTests) TestSqlIngestErrors()

func (*StatementTests) TestSqlIngestInts added in v0.4.0

func (s *StatementTests) TestSqlIngestInts()

func (*StatementTests) TestSqlIngestReplace added in v0.7.0

func (s *StatementTests) TestSqlIngestReplace()

func (*StatementTests) TestSqlPartitionedInts

func (s *StatementTests) TestSqlPartitionedInts()

func (*StatementTests) TestSqlPrepareErrorParamCountMismatch

func (s *StatementTests) TestSqlPrepareErrorParamCountMismatch()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL