sql

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sql provides a javascript module for performing SQL actions against relational databases.

Index

Constants

View Source
const ImportPath = "k6/x/sql"

ImportPath contains module's JavaScript import path.

Variables

This section is empty.

Functions

func New

func New() modules.Module

New creates a new instance of the extension's JavaScript module.

func RegisterDriver

func RegisterDriver(driverName string) *sobek.Symbol

RegisterDriver registers an SQL database driver.

func RegisterModule

func RegisterModule(driverName string) modules.Module

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) Close

func (dbase *Database) Close() error

Close the database and prevents new queries from starting.

func (*Database) Exec

func (dbase *Database) Exec(query string, args ...interface{}) (sql.Result, error)

Exec a query without returning any rows.

func (*Database) Query

func (dbase *Database) Query(query string, args ...interface{}) ([]KeyValue, error)

Query executes a query that returns rows, typically a SELECT.

type KeyValue

type KeyValue map[string]interface{}

KeyValue is a simple key-value pair.

Jump to

Keyboard shortcuts

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