db

package
v1.7.25 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TransactionContextKey = "dbTx"

Variables

View Source
var DB *sql.DB // PostgreSQL-replacement: relational/config data (transactional)
View Source
var TelemetryDB *sql.DB // ClickHouse-replacement: append-only telemetry data (non-transactional)

Functions

func ContextWithTx

func ContextWithTx(ctx context.Context, tx *sql.Tx) context.Context

func ExecuteTransaction

func ExecuteTransaction[T any](f func(tx *sql.Tx) (T, error)) (T, error)

func GetDB

func GetDB() *sql.DB

func GetTx added in v1.7.22

func GetTx(ctx context.Context) *sql.Tx

func Init

func Init() error

func IsSQLite

func IsSQLite() bool

func QueryerFromContext

func QueryerFromContext(ctx context.Context) interface {
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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