dbinspect

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dbinspect captures the database schema state (tables, row counts, indexes) so every benchmark snapshot records what indexes existed BEFORE the run. Inspection uses the raw (unproxied) driver so its own queries never pollute the SQL statistics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Name    string `json:"name"`
	Columns string `json:"columns"`
	Unique  bool   `json:"unique"`
}

Index is one index on a table.

type Schema

type Schema struct {
	Flavor     string  `json:"flavor"`
	CapturedAt string  `json:"captured_at"`
	Error      string  `json:"error,omitempty"`
	Tables     []Table `json:"tables"`
}

Schema is the captured database state. Error is set instead of failing: inspection is best-effort and must never break measurement.

func Collect

func Collect(ctx context.Context, driverName, dsn string) *Schema

Collect inspects the schema through driverName+dsn. It always returns a non-nil Schema; failures are reported via Schema.Error.

type Table

type Table struct {
	Name      string  `json:"name"`
	Engine    string  `json:"engine"`
	Rows      int64   `json:"rows"`
	DataBytes int64   `json:"data_bytes"`
	Indexes   []Index `json:"indexes"`
}

Table is one table with its indexes.

Jump to

Keyboard shortcuts

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