sqljs

package module
v0.0.0-...-594b364 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-sqljs-driver

Go SQL driver for sql.js.

⚠️ This project is experimental. ⚠️

Caveats

Named parameters prefixes

In SQLite's named parameters the prefix (:, @, or $) is included as part of the name.

However Go's database/sql.NamedArg type specifies that "Name must omit any symbol prefix.".

This makes it impossible for go-sqljs-driver to bind a different value to named parameters with the same name but a different prefix:

SELECT * FROM example WHERE col1 = :param1 AND col2 = @param1
-- :param1 and @param1 will always have the same value

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	js.Value
}

func (*Conn) Begin

func (c *Conn) Begin() (driver.Tx, error)

func (*Conn) BeginTx

func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

func (*Conn) Close

func (c *Conn) Close() (err error)

func (*Conn) Prepare

func (c *Conn) Prepare(query string) (stmt driver.Stmt, err error)

type Driver

type Driver struct {
	LocateFile func(string) string
}

func (*Driver) Open

func (d *Driver) Open(name string) (driver.Conn, error)

type Result

type Result struct{}

func (*Result) LastInsertId

func (res *Result) LastInsertId() (int64, error)

func (*Result) RowsAffected

func (res *Result) RowsAffected() (int64, error)

type Stmt

type Stmt struct {
	js.Value
}

func (*Stmt) Close

func (stmt *Stmt) Close() error

func (*Stmt) Exec

func (stmt *Stmt) Exec(args []driver.Value) (driver.Result, error)

func (*Stmt) ExecContext

func (stmt *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (res driver.Result, err error)

func (*Stmt) NumInput

func (stmt *Stmt) NumInput() int

func (*Stmt) Query

func (stmt *Stmt) Query(args []driver.Value) (driver.Rows, error)

func (*Stmt) QueryContext

func (stmt *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (rows driver.Rows, err error)

type StmtRows

type StmtRows struct {
	js.Value
}

func (*StmtRows) Close

func (stmt *StmtRows) Close() (err error)

func (*StmtRows) Columns

func (stmt *StmtRows) Columns() []string

func (*StmtRows) Next

func (stmt *StmtRows) Next(dest []driver.Value) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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