sqlitexx

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package sqlitexx provides another set of extensions for the sqlitex package.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRows = errors.New("sqlitexx: no rows in result set")

ErrNoRows is returned when a query returns no rows.

Functions

This section is empty.

Types

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query represents a prepared SQL query.

func NewQuery

func NewQuery(conn *sqlite.Conn, query string) (*Query, error)

NewQuery creates a query that can be executed.

NewQuery supports only named parameters. The query should be executed to free up prepared resources.

func (*Query) BindBytes

func (q *Query) BindBytes(name string, value []byte) *Query

BindBytes binds a []byte parameter.

If value is nil, NULL is bound.

func (*Query) BindInt

func (q *Query) BindInt(name string, value int) *Query

BindInt binds an int parameter.

func (*Query) BindInt64

func (q *Query) BindInt64(name string, value int64) *Query

BindInt64 binds an int64 parameter.

func (*Query) BindString

func (q *Query) BindString(name, value string) *Query

BindString binds a string parameter.

func (*Query) BindStringIfSet

func (q *Query) BindStringIfSet(name, value string) *Query

BindStringIfSet binds a string parameter if the value is not empty.

func (*Query) BindUint64

func (q *Query) BindUint64(name string, value uint64) *Query

BindUint64 binds a uint64 parameter.

func (*Query) Exec

func (q *Query) Exec() (err error)

Exec executes the query without returning any rows.

func (*Query) QueryAll

func (q *Query) QueryAll(resultFn ResultFunc) (err error)

QueryAll executes the query and processes all returned rows.

func (*Query) QueryIter

func (q *Query) QueryIter() iter.Seq2[*sqlite.Stmt, error]

QueryIter returns an iterator for the query results.

The statement is reset when the iteration completes or breaks early.

func (*Query) QueryRow

func (q *Query) QueryRow(resultFn ResultFunc) (err error)

QueryRow executes the query and asserts a single row.

If no rows are returned, ErrNoRows is returned.

type ResultFunc

type ResultFunc = func(stmt *sqlite.Stmt) error

ResultFunc is a function that processes a row from a query result.

Jump to

Keyboard shortcuts

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