query

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package query executes SQL through a conn.Pool, enforcing the safety gate, single-statement rule, optional row limit, and context timeout.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGuard          = errors.New("guard")
	ErrMultiStatement = errors.New("multi-statement")
	ErrSQL            = errors.New("sql")
	ErrTimeout        = errors.New("timeout")
)

Typed errors mapped by the cli layer to exit codes.

Functions

func Execute

func Execute(ctx context.Context, pool *conn.Pool, sqlText string, opts Options) (result.Result, error)

Execute runs a single SQL statement. It first applies the safety guard, then the multi-statement check, then executes with the given timeout and optional LIMIT wrapping for SELECT queries.

func ExecuteTxn

func ExecuteTxn(ctx context.Context, pool *conn.Pool, statements []string, opts Options) (result.Result, error)

ExecuteTxn runs multiple statements in one transaction atomically. Every statement is individually guarded; any error rolls back.

func ExecuteWrite

func ExecuteWrite(ctx context.Context, pool *conn.Pool, sqlText string, opts Options) (result.Result, error)

ExecuteWrite runs a single DML/DDL statement inside a transaction and commits. It enforces the same guard as Execute.

Types

type Options

type Options struct {
	Write   bool
	DDL     bool
	Yes     bool
	Limit   int
	Timeout time.Duration
}

Options controls execution permissions and limits.

Jump to

Keyboard shortcuts

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