query

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Prepare added in v0.18.0

Prepare a statement by binding and preparing it. If there is no ongoing transaction, a read-only transaction is created for the duration of the preparation.

Types

type BeginStmt

type BeginStmt struct {
	Writable bool
}

BeginStmt is a statement that creates a new transaction.

func (BeginStmt) NeedsTransaction added in v0.18.0

func (stmt BeginStmt) NeedsTransaction() bool

func (BeginStmt) Run

func (stmt BeginStmt) Run(ctx *statement.Context) (*statement.Result, error)

type CommitStmt

type CommitStmt struct{}

CommitStmt is a statement that commits the current active transaction.

func (CommitStmt) IsReadOnly

func (stmt CommitStmt) IsReadOnly() bool

func (CommitStmt) NeedsTransaction added in v0.18.0

func (stmt CommitStmt) NeedsTransaction() bool

func (CommitStmt) Run

func (stmt CommitStmt) Run(ctx *statement.Context) (*statement.Result, error)

type Context

type Context struct {
	Ctx    context.Context
	DB     *database.Database
	Conn   *database.Connection
	Params []environment.Param
}

type PreparedStatement added in v0.18.0

type PreparedStatement struct {
	statement.Statement
}

type Query

type Query struct {
	Statements []statement.Statement
}

A Query can execute statements against the database. It can read or write data from any table, or even alter the structure of the database. Results are returned as streams.

func New

func New(statements ...statement.Statement) *Query

New creates a new query with the given statements.

func (*Query) Run

func (q *Query) Run(c *Context) (*statement.Result, error)

Run executes all the statements in their own transaction and returns the last result.

type RollbackStmt

type RollbackStmt struct{}

RollbackStmt is a statement that rollbacks the current active transaction.

func (RollbackStmt) NeedsTransaction added in v0.18.0

func (stmt RollbackStmt) NeedsTransaction() bool

func (RollbackStmt) Run

func (stmt RollbackStmt) Run(ctx *statement.Context) (*statement.Result, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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