drivertest

package
v0.105.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package drivertest provides utilities for driver testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectionID

func ConnectionID(db *sql.DB) (int, error)

ConnectionID returns the hdb connection id.

func CreateSchema

func CreateSchema(db *sql.DB, schema string) error

CreateSchema creates a schema on the database.

func DSN

func DSN() string

DSN returns the dsn parameter.

func DefaultAttrs

func DefaultAttrs() map[string]interface{}

DefaultAttrs returns the key value map of connector default testing attributes.

func DropSchema

func DropSchema(db *sql.DB, schema string) error

DropSchema drops a schema from the database.

func DropTable

func DropTable(db *sql.DB, schema, table string) error

DropTable drops a table from the database.

func DummySelect

func DummySelect(db *sql.DB) error

DummySelect executes a select dummy on hdb.

func NumProcsInSchema

func NumProcsInSchema(db *sql.DB, schema string) (int, error)

NumProcsInSchema returns the number of stored procedures in a database schema.

func NumTablesInSchema

func NumTablesInSchema(db *sql.DB, schema string) (int, error)

NumTablesInSchema returns the number of tables in a database schema.

func PingInterval

func PingInterval() int

PingInterval returns the ping interval.

func QuerySchemasPrefix

func QuerySchemasPrefix(db *sql.DB, prefix string) ([]string, error)

QuerySchemasPrefix returns all schemas of a database starting with prefix in name.

func QueryTablesPrefix

func QueryTablesPrefix(db *sql.DB, prefix string) ([]string, error)

QueryTablesPrefix returns all tables of a database starting with prefix in name.

func Schema

func Schema() string

Schema returns the database schema.

func SessionVariable

func SessionVariable(k string, db *sql.DB) (string, error)

SessionVariable returns the value of a session variable.

func SessionVariables

func SessionVariables(db *sql.DB) (map[string]string, error)

SessionVariables returns a map of current session variables.

func Setup

func Setup(db *sql.DB)

Setup creates the database schema.

func Teardown

func Teardown(db *sql.DB, drop bool)

Teardown deletes the database schema(s).

Types

type ColumnType added in v0.104.0

type ColumnType interface {
	IsSupportedHDBVersion(version *hdb.Version) bool
	IsSupportedDfv(dfv int) bool
	TypeName() string
	DatabaseTypeName(version *hdb.Version, dfv int) string
	Column() string
	Length() (length int64, ok bool)
	DecimalSize() (precision, scale int64, ok bool)
	ScanType(dfv int) reflect.Type
	Nullable() (nullable, ok bool)
	SetNullable(nullable bool) ColumnType
	SRID() int32
}

ColumnType represents a database column.

func NewDecimalColumn added in v0.104.0

func NewDecimalColumn(dataType DataType, precision, scale int64) ColumnType

NewDecimalColumn returns a new decimal database column.

func NewSpatialColumn added in v0.104.0

func NewSpatialColumn(dataType DataType, srid int32) ColumnType

NewSpatialColumn returns a new spatial database column.

func NewStdColumn added in v0.104.0

func NewStdColumn(dataType DataType) ColumnType

NewStdColumn returns a new standard database column.

func NewVarColumn added in v0.104.0

func NewVarColumn(dataType DataType, length int64) ColumnType

NewVarColumn returns a new variable database column.

type DataType added in v0.104.0

type DataType byte

DataType is the type definition for the supported database types.

const (
	DtTinyint DataType = iota
	DtSmallint
	DtInteger
	DtBigint
	DtDecimal
	DtSmalldecimal
	DtReal
	DtDouble
	DtChar
	DtVarchar
	DtNChar
	DtNVarchar
	DtShorttext
	DtAlphanum
	DtBinary
	DtVarbinary
	DtDate
	DtTime
	DtTimestamp
	DtLongdate
	DtSeconddate
	DtDaydate
	DtSecondtime
	DtClob
	DtNClob
	DtBlob
	DtText
	DtBintext
	DtBoolean
	DtSTPoint
	DtSTGeometry
)

DataType constants.

func (DataType) DatabaseTypeName added in v0.104.0

func (t DataType) DatabaseTypeName(version *hdb.Version, dfv int) string

DatabaseTypeName implements the ColumnType interface.

func (DataType) IsSupportedDfv added in v0.104.0

func (t DataType) IsSupportedDfv(dfv int) bool

IsSupportedDfv implements the ColumnType interface.

func (DataType) IsSupportedHDBVersion added in v0.104.0

func (t DataType) IsSupportedHDBVersion(version *hdb.Version) bool

IsSupportedHDBVersion implements the ColumnType interface.

func (DataType) ScanType added in v0.104.0

func (t DataType) ScanType(dfv int) reflect.Type

ScanType implements the ColumnType interface.

func (DataType) TypeName added in v0.104.0

func (t DataType) TypeName() string

TypeName implements the ColumnType interface.

Jump to

Keyboard shortcuts

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