sqldb

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MPL-2.0 Imports: 2 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commit

func Commit(tx *Tx) error

Commit commits the given transaction.

See (*database/sql.Tx).Commit() for additional documentation.

func Exec

func Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

See (*database/sql.DB).ExecContext() for additional documentation.

func ExecTx

func ExecTx(tx *Tx, ctx context.Context, query string, args ...interface{}) (sql.Result, error)

ExecTx is like Exec but executes the query in the given transaction.

See (*database/sql.Tx).ExecContext() for additional documentation.

func Rollback

func Rollback(tx *Tx) error

Rollback rolls back the given transaction.

See (*database/sql.Tx).Rollback() for additional documentation.

Types

type Row

type Row struct{}

Row is the result of calling QueryRow to select a single row.

See *database/sql.Row for additional documentation.

func QueryRow

func QueryRow(ctx context.Context, query string, args ...interface{}) *Row

QueryRow executes a query that is expected to return at most one row.

See (*database/sql.DB).QueryRowContext() for additional documentation.

func QueryRowTx

func QueryRowTx(tx *Tx, ctx context.Context, query string, args ...interface{}) *Row

QueryRowTx is like QueryRow but executes the query in the given transaction.

See (*database/sql.Tx).QueryRowContext() for additional documentation.

func (*Row) Scan

func (*Row) Scan(dest ...interface{}) error

Scan copies the columns from the matched row into the values pointed at by dest.

See (*database/sql.Row).Scan() for additional documentation.

type Rows

type Rows struct{}

Rows is the result of a query. Its cursor starts before the first row of the result set. Use Next to advance from row to row.

See *database/sql.Rows for additional documentation.

func Query

func Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.

See (*database/sql.DB).QueryContext() for additional documentation.

func QueryTx

func QueryTx(tx *Tx, ctx context.Context, query string, args ...interface{}) (*Rows, error)

QueryTx is like Query but executes the query in the given transaction.

See (*database/sql.Tx).QueryContext() for additional documentation.

func (*Rows) Close

func (*Rows) Close() error

Close closes the Rows, preventing further enumeration.

See (*database/sql.Rows).Close() for additional documentation.

func (*Rows) Err

func (*Rows) Err() error

Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.

See (*database/sql.Rows).Err() for additional documentation.

func (*Rows) Next

func (*Rows) Next() bool

Next prepares the next result row for reading with the Scan method. It returns true on success, or false if there is no next result row or an error happened while preparing it. Err should be consulted to distinguish between the two cases.

Every call to Scan, even the first one, must be preceded by a call to Next.

See (*database/sql.Rows).Next() for additional documentation.

func (*Rows) Scan

func (*Rows) Scan(dest ...interface{}) error

Scan copies the columns in the current row into the values pointed at by dest. The number of values in dest must be the same as the number of columns in Rows.

See (*database/sql.Rows).Scan() for additional documentation.

type Tx

type Tx struct{}

Tx is a handle to a database transaction.

See *database/sql.Tx for additional documentation.

func Begin

func Begin(ctx context.Context) (*Tx, error)

Begin opens a new database transaction.

See (*database/sql.DB).Begin() for additional documentation.

Jump to

Keyboard shortcuts

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