db

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 9 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 GetTelemetryIngestCounters added in v1.9.0

func GetTelemetryIngestCounters() (dropped map[string]uint64, droppedTotal uint64, insertFailures uint64)

func GetTx added in v1.7.22

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

func Init

func Init() error

Init opens the main (transactional) database selected by the transactional_* build axis, then the telemetry database selected by the telemetry_* build axis.

func IsDuckDBTelemetry added in v1.9.0

func IsDuckDBTelemetry() bool

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
}

func RecordTelemetryInsertFailure added in v1.9.0

func RecordTelemetryInsertFailure()

func RecordTelemetryRowDropped added in v1.9.0

func RecordTelemetryRowDropped(table string)

func TelemetryBackendName added in v1.9.0

func TelemetryBackendName() string

Types

type TelemetryEngineStats added in v1.9.0

type TelemetryEngineStats struct {
	DBSizeBytes       int64 `json:"dbSizeBytes"`
	WALSizeBytes      int64 `json:"walSizeBytes"`
	MemoryUsedBytes   int64 `json:"memoryUsedBytes"`
	ReadPoolInUse     int   `json:"readPoolInUse"`
	ReadPoolWaitCount int64 `json:"readPoolWaitCount"`
	ReadPoolWaitMs    int64 `json:"readPoolWaitMs"`
}

func GetTelemetryEngineStats added in v1.9.0

func GetTelemetryEngineStats(ctx context.Context) (TelemetryEngineStats, bool)

Jump to

Keyboard shortcuts

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