Documentation
¶
Overview ¶
Package sql provides a javascript module for performing SQL actions against relational databases.
Index ¶
- Constants
- func New() modules.Module
- func RegisterDriver(driverName string) *sobek.Symbol
- func RegisterModule(driverName string) modules.Module
- type Database
- func (dbase *Database) Close() error
- func (dbase *Database) Exec(query string, args ...interface{}) (sql.Result, error)
- func (dbase *Database) ExecWithTimeout(timeout string, query string, args ...interface{}) (sql.Result, error)
- func (dbase *Database) Query(query string, args ...interface{}) ([]KeyValue, error)
- func (dbase *Database) QueryWithTimeout(timeout string, query string, args ...interface{}) ([]KeyValue, error)
- type KeyValue
Constants ¶
const ImportPath = "k6/x/sql"
ImportPath contains module's JavaScript import path.
Variables ¶
This section is empty.
Functions ¶
func RegisterDriver ¶
RegisterDriver registers an SQL database driver.
func RegisterModule ¶
RegisterModule registers an SQL database driver module. The module import path will be k6/x/sql/driver/ + driverName. The module's default export will be the driver id Symbol.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is a database handle representing a pool of zero or more underlying connections.
func (*Database) ExecWithTimeout ¶ added in v1.0.4
func (dbase *Database) ExecWithTimeout(timeout string, query string, args ...interface{}) (sql.Result, error)
ExecWithTimeout executes a query (with a timeout) without returning any rows. The timeout can be specified as a duration string.
func (*Database) QueryWithTimeout ¶ added in v1.0.4
func (dbase *Database) QueryWithTimeout(timeout string, query string, args ...interface{}) ([]KeyValue, error)
QueryWithTimeout executes a query (with a timeout) that returns rows, typically a SELECT. The timeout can be specified as a duration string.