sqlstatements

package
v0.1.49 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package sqlstatements is the sql trace kind: it records the SQL statements commons-db runs on chosen connections, as the SQL statement tap publishes them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kind

Kind is the sql trace kind: statements masked and capped at 64KiB a value.

Types

type Params

type Params struct {
	// Connections name the connections to observe, as profiles reference
	// them, "*" for every connection, or "self" for the server's own
	// database, which "*" does not include.
	Connections []string `json:"connections" clicky:"required,title=Connections"`
	// MinDuration, a duration such as 100ms, records only statements that ran
	// at least that long.
	MinDuration string `json:"minDuration,omitempty" clicky:"title=Minimum duration"`
}

Params choose the statements a capture records.

func (Params) Validate

func (p Params) Validate() error

type StatementRow

type StatementRow struct {
	traces.Truncation
	StartedAt  time.Time `json:"startedAt" pretty:"label=Started" sort:"startedAt"`
	Connection string    `json:"connection" filter:"terms"`
	Driver     string    `json:"driver" filter:"terms"`
	SQL        string    `json:"sql" pretty:"label=SQL" filter:"text"`
	Args       []any     `json:"args,omitempty" pretty:"hide"`
	DurationMs float64   `json:"durationMs" pretty:"label=Duration,type=duration,unit=ms" sort:"durationMs"`
	Rows       int64     `json:"rows" sort:"rows"`
	Error      string    `json:"error,omitempty" filter:"text"`
}

StatementRow is one statement as a capture stores it.

func FromStatement

func FromStatement(statement connection.Statement) StatementRow

FromStatement is the row a capture stores for statement.

Jump to

Keyboard shortcuts

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