query

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package query dump functions that match LXD's dump functionality.

Package query retry functions that match LXD's database retry patterns.

Package query transaction functions that match LXD's transaction handling patterns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(ctx context.Context, tx *sql.Tx, schemaOnly bool) (string, error)

Dump returns a SQL text dump of all rows across all tables, similar to sqlite3's dump feature. This implementation matches LXD's Dump function.

func IsRetriableError

func IsRetriableError(err error) bool

IsRetriableError returns true if the given error might be transient and the interaction can be safely retried. This implementation matches LXD's IsRetriableError function.

func Retry

func Retry(ctx context.Context, f func(ctx context.Context) error) error

Retry wraps a function that interacts with the database, and retries it in case a transient error is hit. This should by typically used to wrap transactions. This implementation matches LXD's Retry function.

func Transaction

func Transaction(ctx context.Context, db *sql.DB, f func(context.Context, *sql.Tx) error) error

Transaction executes the given function within a database transaction with a 10s context timeout. This implementation matches LXD's Transaction function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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