Documentation
¶
Index ¶
- func LoadSettings(ctx context.Context, config backend.DataSourceInstanceSettings) (settings sqlds.DriverSettings, err error)
- func NewDriver(name string, dbdata Data, converters []sqlutil.Converter, opts DriverOpts) (TestDS, *SqlHandler)
- type Column
- type Data
- type DriverOpts
- type SqlHandler
- func (s SqlHandler) Close() error
- func (s SqlHandler) ColumnTypeDatabaseTypeName(index int) string
- func (s SqlHandler) ColumnTypeScanType(index int) reflect.Type
- func (s *SqlHandler) Columns() []string
- func (s *SqlHandler) Next(dest []driver.Value) error
- func (s *SqlHandler) Ping(ctx context.Context) error
- func (s *SqlHandler) Query(args []driver.Value) (driver.Rows, error)
- type State
- type TestDS
- func (s TestDS) Connect(ctx context.Context, cfg backend.DataSourceInstanceSettings, ...) (*sql.DB, error)
- func (s TestDS) Converters() []sqlutil.Converter
- func (s TestDS) Macros() sqlds.Macros
- func (s TestDS) Open() (*sql.DB, error)
- func (s TestDS) Settings(ctx context.Context, config backend.DataSourceInstanceSettings) sqlds.DriverSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadSettings ¶
func LoadSettings(ctx context.Context, config backend.DataSourceInstanceSettings) (settings sqlds.DriverSettings, err error)
LoadSettings will read and validate Settings from the DataSourceConfig
func NewDriver ¶
func NewDriver(name string, dbdata Data, converters []sqlutil.Converter, opts DriverOpts) (TestDS, *SqlHandler)
NewDriver creates and registers a new test datasource driver
Types ¶
type DriverOpts ¶
type DriverOpts struct { ConnectDelay int ConnectError error ConnectFailTimes int OnConnect func(msg []byte) QueryDelay int QueryError error QueryFailTimes int }
DriverOpts the optional settings
type SqlHandler ¶
type SqlHandler struct { mock.DBHandler Data Data Opts DriverOpts State State // contains filtered or unexported fields }
SqlHandler handles driver functions
func NewDriverHandler ¶
func NewDriverHandler(data Data, opts DriverOpts) SqlHandler
NewDriverHandler creates a new driver handler
func (SqlHandler) Close ¶
func (s SqlHandler) Close() error
Close implements the database Close interface
func (SqlHandler) ColumnTypeDatabaseTypeName ¶
func (s SqlHandler) ColumnTypeDatabaseTypeName(index int) string
ColumnTypeDatabaseTypeName returns the database type for the column
func (SqlHandler) ColumnTypeScanType ¶
func (s SqlHandler) ColumnTypeScanType(index int) reflect.Type
ColumnTypeScanType returns the scan type for the column
func (*SqlHandler) Columns ¶
func (s *SqlHandler) Columns() []string
Columns represents columns from a query
func (*SqlHandler) Next ¶
func (s *SqlHandler) Next(dest []driver.Value) error
Next iterates over rows
type TestDS ¶
type TestDS struct { sqlds.Driver // contains filtered or unexported fields }
TestDS ...
func NewTestDS ¶
func NewTestDS(openDBfn func(msg json.RawMessage) (*sql.DB, error), converters []sqlutil.Converter) TestDS
NewTestDS creates a new test datasource driver
func (TestDS) Connect ¶
func (s TestDS) Connect(ctx context.Context, cfg backend.DataSourceInstanceSettings, msg json.RawMessage) (*sql.DB, error)
Connect - connects to the test database
func (TestDS) Converters ¶
Converters - Converters for the test database
Click to show internal directories.
Click to hide internal directories.