Documentation
¶
Overview ¶
Package sqlstats wraps database/sql drivers with a measuring proxy and aggregates every query into an in-memory table. Works with any driver (MySQL/MariaDB via go-sql-driver, PostgreSQL via pgx stdlib or lib/pq).
Index ¶
Constants ¶
const DriverSuffix = ":isutools"
DriverSuffix is appended to the original driver name on registration: Register("mysql") makes "mysql:isutools" available.
Variables ¶
var Default = NewStore(agg.DefaultMaxKeys)
Default is the generation-scoped store all proxied drivers report into.
Functions ¶
Types ¶
type Store ¶ added in v0.2.0
type Store struct {
// contains filtered or unexported fields
}
Store owns generation-scoped SQL aggregation tables.
func (*Store) CurrentGeneration ¶ added in v0.2.0
CurrentGeneration identifies the generation accepting new observations.
func (*Store) Observe ¶ added in v0.2.0
Observe adds an already-normalized query to the current generation.
func (*Store) ObserveResult ¶ added in v0.2.0
ObserveResult adds an already-normalized query result to the current generation.
func (*Store) Reset ¶ added in v0.2.0
func (s *Store) Reset()
Reset starts a new generation and discards the frozen data. Prefer Rotate when the caller needs to retain the previous generation.