Help us shape the future of Go! Take the 2026 Go Developer Survey

pgcompare

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(data ReportData, outPath string) error

func NewBenchmark

func NewBenchmark(log *slog.Logger, dsn string) (*benchmark, error)

func NewDockerComparator

func NewDockerComparator(log *slog.Logger, cfg *Config) (*dockerComparator, error)

Types

type BenchResult

type BenchResult struct {
	Phase string
	Stats []Stats
	Plans []*PlanNode
}

type Config

type Config struct {
	ProjectDir string

	Migration struct {
		EnvVar        string `yaml:"env_var"`
		BeforeVersion string `yaml:"before_version"`
		AfterVersion  string `yaml:"after_version"`
	} `yaml:"migration"`

	Setup struct {
		Command string `yaml:"command"`
	} `yaml:"setup"`

	Benchmark struct {
		BeforeQueries    string `yaml:"before_queries"`
		AfterQueries     string `yaml:"after_queries"`
		WarmupIterations int    `yaml:"warmup_iterations" default:"0"`
		Iterations       int    `yaml:"iterations"`
		Concurrency      int    `yaml:"concurrency"`
		Repeats          int    `yaml:"repeats"`
	} `yaml:"benchmark"`

	Report struct {
		Description []DescriptionEntry `yaml:"description"`
	} `yaml:"report"`

	DSN string
}

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

type DescriptionEntry added in v1.0.0

type DescriptionEntry struct {
	Query    string `yaml:"query"`
	What     string `yaml:"what"`
	Changes  string `yaml:"changes"`
	Expected string `yaml:"expected"`
}

type PlanDiff

type PlanDiff struct {
	QueryName string
	Before    *PlanNode
	After     *PlanNode
	Summary   []string
}

type PlanNode

type PlanNode struct {
	NodeType        string
	RelationName    string
	IndexName       string
	ActualRows      float64
	ActualTotalTime time.Duration
	Children        []*PlanNode
}

type Query

type Query struct {
	Name string
	SQL  string
}

type ReportData

type ReportData struct {
	GeneratedAt      time.Time
	Iterations       int
	WarmupIterations int
	Concurrency      int
	Repeats          int
	Speedups         []float64
	Before           *BenchResult
	After            *BenchResult
	Diffs            []PlanDiff
	Description      []DescriptionEntry
}

type Stats

type Stats struct {
	QueryName                             string
	Min, Max, P50, P95, P99, Mean, StdDev time.Duration
	QPS                                   float64
	ErrorRate                             float64
	Errors                                []string
}

Jump to

Keyboard shortcuts

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