Documentation ¶
Overview ¶
The package integration contains helpers to setup and teardown database for various connection types, as well as shared code to run the same tests for types and database/sql methods for the cgo and go implementation.
Files starting with `type_` contain functions to test a specific data type. These tests should follow these constraints:
- The underlying test should be run for each connection type once.
- Each separate test run must create its own table. The table must not be deleted after the test.
- If a type can be nulled the handling of the null value must be tested.
Files starting with `sql_` contain functions to test a function group from database/sql. These tests should follow these constraints:
- Methods accepting a context must be tested for their handling of the context.
- All execution paths must be tested. E.g. .Begin returns a transaction - which can be commmited or rolled back. In that case both the .Commit and the .Rollback must be tested.
Index ¶
- Variables
- func DoTestBigDateTime(t *testing.T)
- func DoTestBigInt(t *testing.T)
- func DoTestBigTime(t *testing.T)
- func DoTestBinary(t *testing.T)
- func DoTestBit(t *testing.T)
- func DoTestChar(t *testing.T)
- func DoTestDate(t *testing.T)
- func DoTestDateTime(t *testing.T)
- func DoTestDecimal(t *testing.T)
- func DoTestDecimal10(t *testing.T)
- func DoTestDecimal380(t *testing.T)
- func DoTestDecimal3838(t *testing.T)
- func DoTestFloat(t *testing.T)
- func DoTestImage(t *testing.T)
- func DoTestInt(t *testing.T)
- func DoTestMoney(t *testing.T)
- func DoTestMoney4(t *testing.T)
- func DoTestNChar(t *testing.T)
- func DoTestNVarChar(t *testing.T)
- func DoTestNullBigDateTime(t *testing.T)
- func DoTestNullBigInt(t *testing.T)
- func DoTestNullBigTime(t *testing.T)
- func DoTestNullBinary(t *testing.T)
- func DoTestNullChar(t *testing.T)
- func DoTestNullDate(t *testing.T)
- func DoTestNullDateTime(t *testing.T)
- func DoTestNullDecimal(t *testing.T)
- func DoTestNullFloat(t *testing.T)
- func DoTestNullInt(t *testing.T)
- func DoTestNullMoney(t *testing.T)
- func DoTestNullMoney4(t *testing.T)
- func DoTestNullNChar(t *testing.T)
- func DoTestNullNVarChar(t *testing.T)
- func DoTestNullReal(t *testing.T)
- func DoTestNullSmallDateTime(t *testing.T)
- func DoTestNullSmallInt(t *testing.T)
- func DoTestNullTime(t *testing.T)
- func DoTestNullTinyInt(t *testing.T)
- func DoTestNullUnsignedBigInt(t *testing.T)
- func DoTestNullUnsignedInt(t *testing.T)
- func DoTestNullUnsignedSmallInt(t *testing.T)
- func DoTestNullVarBinary(t *testing.T)
- func DoTestNullVarChar(t *testing.T)
- func DoTestReal(t *testing.T)
- func DoTestSQLExec(t *testing.T)
- func DoTestSQLQueryRow(t *testing.T)
- func DoTestSQLTx(t *testing.T)
- func DoTestSmallDateTime(t *testing.T)
- func DoTestSmallInt(t *testing.T)
- func DoTestText(t *testing.T)
- func DoTestTime(t *testing.T)
- func DoTestTinyInt(t *testing.T)
- func DoTestUniChar(t *testing.T)
- func DoTestUniText(t *testing.T)
- func DoTestUnsignedBigInt(t *testing.T)
- func DoTestUnsignedInt(t *testing.T)
- func DoTestUnsignedSmallInt(t *testing.T)
- func DoTestVarBinary(t *testing.T)
- func DoTestVarChar(t *testing.T)
- func RandomNumber() string
- func RegisterDSN(name string, info interface{}, connectorFn ConnectorCreator) error
- func SetupDB(ctx context.Context, info interface{}, dbname string) error
- func SetupTableInsert(db *sql.DB, tableName, aseType string, samples ...interface{}) (*sql.Rows, func() error, error)
- func TeardownDB(ctx context.Context, info interface{}) error
- func TestForEachDB(testName string, t *testing.T, testFn DBTestFunc)
- type ConnectorCreator
- type DBTestFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ASE doesn't handle creating multiple databases concurrently well. // To prevent spurious test errors the DBCreateLock is used to // synchronise the goroutines creating databases. DBCreateLock = new(sync.Mutex) )
Functions ¶
func DoTestBigDateTime ¶
DoTestBigDateTime tests the handling of the BigDateTime.
func DoTestBigTime ¶
DoTestBigTime tests the handling of the BigTime.
func DoTestDateTime ¶
DoTestDateTime tests the handling of the DateTime.
func DoTestDecimal ¶
DoTestDecimal tests the handling of the Decimal.
func DoTestDecimal10 ¶
DoTestDecimal10 tests the handling of the Decimal10.
func DoTestDecimal380 ¶
DoTestDecimal380 tests the handling of the Decimal380.
func DoTestDecimal3838 ¶
DoTestDecimal3838 tests the handling of the Decimal3838.
func DoTestNVarChar ¶
DoTestNVarChar tests the handling of the NVarChar.
func DoTestNullBigDateTime ¶
DoTestNullBigDateTime tests the handling of the NullBigDateTime.
func DoTestNullBigInt ¶
DoTestNullBigInt tests the handling of the NullBigInt.
func DoTestNullBigTime ¶
DoTestNullBigTime tests the handling of the NullBigTime.
func DoTestNullBinary ¶
DoTestNullBinary tests the handling of the NullBinary.
func DoTestNullChar ¶
DoTestNullChar tests the handling of the NullChar.
func DoTestNullDate ¶
DoTestNullDate tests the handling of the NullDate.
func DoTestNullDateTime ¶
DoTestNullDateTime tests the handling of the NullDateTime.
func DoTestNullDecimal ¶
DoTestNullDecimal tests the handling of the NullDecimal.
func DoTestNullFloat ¶
DoTestNullFloat tests the handling of the NullFloat.
func DoTestNullInt ¶
DoTestNullInt tests the handling of the NullInt.
func DoTestNullMoney ¶
DoTestNullMoney tests the handling of the NullMoney.
func DoTestNullMoney4 ¶
DoTestNullMoney4 tests the handling of the NullMoney4.
func DoTestNullNChar ¶
DoTestNullNChar tests the handling of the NullNChar.
func DoTestNullNVarChar ¶
DoTestNullNVarChar tests the handling of the NullNVarChar.
func DoTestNullReal ¶
DoTestNullReal tests the handling of the NullReal.
func DoTestNullSmallDateTime ¶
DoTestNullSmallDateTime tests the handling of the NullSmallDateTime.
func DoTestNullSmallInt ¶
DoTestNullSmallInt tests the handling of the NullSmallInt.
func DoTestNullTime ¶
DoTestNullTime tests the handling of the NullTime.
func DoTestNullTinyInt ¶
DoTestNullTinyInt tests the handling of the NullTinyInt.
func DoTestNullUnsignedBigInt ¶
DoTestNullUnsignedBigInt tests the handling of the NullUnsignedBigInt.
func DoTestNullUnsignedInt ¶
DoTestNullUnsignedInt tests the handling of the NullUnsignedInt.
func DoTestNullUnsignedSmallInt ¶
DoTestNullUnsignedSmallInt tests the handling of the NullUnsignedSmallInt.
func DoTestNullVarBinary ¶
DoTestNullVarBinary tests the handling of the NullVarBinary.
func DoTestNullVarChar ¶
DoTestNullVarChar tests the handling of the NullVarChar.
func DoTestSQLQueryRow ¶
DoTestSQLQueryRow runs tests for sql.QueryRow.
func DoTestSmallDateTime ¶
DoTestSmallDateTime tests the handling of the SmallDateTime.
func DoTestSmallInt ¶
DoTestSmallInt tests the handling of the SmallInt.
func DoTestTinyInt ¶
DoTestTinyInt tests the handling of the TinyInt.
func DoTestUniChar ¶
DoTestUniChar tests the handling of the UniChar.
func DoTestUniText ¶
DoTestUniText tests the handling of the UniText.
func DoTestUnsignedBigInt ¶
DoTestUnsignedBigInt tests the handling of the UnsignedBigInt.
func DoTestUnsignedInt ¶
DoTestUnsignedInt tests the handling of the UnsignedInt.
func DoTestUnsignedSmallInt ¶
DoTestUnsignedSmallInt tests the handling of the UnsignedSmallInt.
func DoTestVarBinary ¶
DoTestVarBinary tests the handling of the VarBinary.
func DoTestVarChar ¶
DoTestVarChar tests the handling of the VarChar.
func RandomNumber ¶
func RandomNumber() string
RandomNumber returns an unsecure random number as a string.
This method is used to ensure random names for similar objects being created for testing purposes in databases.
func RegisterDSN ¶
func RegisterDSN(name string, info interface{}, connectorFn ConnectorCreator) error
RegisterDSN registers at least one new genSQLDBFn in genSQLDBMap based on sql.Open. If connectorFn is non-nil a second genSQLDBFn is stored with the suffix `connector`.
func SetupDB ¶
SetupDB safely creates a database with the given name and sets .Database on the passed info.
func SetupTableInsert ¶
func SetupTableInsert(db *sql.DB, tableName, aseType string, samples ...interface{}) (*sql.Rows, func() error, error)
SetupTableInsert creates a table with the passed type and inserts all passed samples as rows.
func TeardownDB ¶
TeardownDB safely deletes the database indicated by .Database of the passed info and unsets the member.
func TestForEachDB ¶
func TestForEachDB(testName string, t *testing.T, testFn DBTestFunc)
TestForEachDB runs the given DBTestFunc against all registered connection types.
Types ¶
type ConnectorCreator ¶
ConnectorCreator is the interface for function expected by InitDBs to initialize driver.Connectors.
Source Files ¶
- doc.go
- dsn.go
- helpers.go
- samples.go
- setup_teardown.go
- sql_exec.go
- sql_queryrow.go
- sql_tx.go
- type_bigdatetime.go
- type_bigint.go
- type_bigtime.go
- type_binary.go
- type_bit.go
- type_char.go
- type_date.go
- type_datetime.go
- type_decimal.go
- type_decimal10.go
- type_decimal380.go
- type_decimal3838.go
- type_float.go
- type_image.go
- type_int.go
- type_money.go
- type_money4.go
- type_nchar.go
- type_nullbigdatetime.go
- type_nullbigint.go
- type_nullbigtime.go
- type_nullbinary.go
- type_nullchar.go
- type_nulldate.go
- type_nulldatetime.go
- type_nulldecimal.go
- type_nullfloat.go
- type_nullint.go
- type_nullmoney.go
- type_nullmoney4.go
- type_nullnchar.go
- type_nullnvarchar.go
- type_nullreal.go
- type_nullsmalldatetime.go
- type_nullsmallint.go
- type_nulltime.go
- type_nulltinyint.go
- type_nullunsignedbigint.go
- type_nullunsignedint.go
- type_nullunsignedsmallint.go
- type_nullvarbinary.go
- type_nullvarchar.go
- type_nvarchar.go
- type_real.go
- type_smalldatetime.go
- type_smallint.go
- type_text.go
- type_time.go
- type_tinyint.go
- type_unichar.go
- type_unitext.go
- type_unsignedbigint.go
- type_unsignedint.go
- type_unsignedsmallint.go
- type_varbinary.go
- type_varchar.go