stdsql

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryCustomMetrics

func QueryCustomMetrics(ctx context.Context, db RowQuerier, sqlQuery string, args ...any) ([]*scrapper.CustomMetricsRow, error)

func QueryShape added in v0.8.3

func QueryShape(ctx context.Context, db RowQuerier, sql string) ([]*scrapper.QueryShapeColumn, error)

func RunRawQuery added in v0.13.7

func RunRawQuery(ctx context.Context, db RowQuerier, sqlQuery string) (scrapper.RawQueryRowIterator, error)

RunRawQuery executes sqlQuery and returns an iterator over typed rows. The iterator must be Close()'d by the caller; it also auto-closes on io.EOF.

Unlike QueryCustomMetrics this path preserves every column: segment* names are not sidelined, and string columns come back as StringValue rather than being re-parsed and collapsed to IgnoredValue. Unknown driver types fall back to StringValue(fmt.Sprint(v)) so nothing is silently dropped.

Types

type RawDB added in v0.11.0

type RawDB struct{ DB *sqlx.DB }

RawDB wraps a *sqlx.DB to satisfy RowQuerier without any enrichment. Use this only in tests; production code should pass an executor.

func (*RawDB) QueryRows added in v0.11.0

func (r *RawDB) QueryRows(ctx context.Context, q string, args ...interface{}) (*sqlx.Rows, error)

type RowQuerier added in v0.11.0

type RowQuerier interface {
	QueryRows(ctx context.Context, q string, args ...interface{}) (*sqlx.Rows, error)
}

RowQuerier is the minimal interface for executing queries that return rows. It is satisfied by all StdSqlExecutor implementations (which add SQL comment enrichment, query tagging, and stats collection) and by RawDB for tests.

Jump to

Keyboard shortcuts

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