package migrationstats

import "github.com/pressly/goose/v3/internal/migrationstats"

Index

Types

type FileWalker

type FileWalker interface {
	// Walk invokes fn for each file.
	Walk(fn func(filename string, r io.Reader) error) error
}

FileWalker walks all files for GatherStats.

type Stats

type Stats struct {
	// FileName is the name of the file.
	FileName string
	// Version is the version of the migration.
	Version int64
	// Tx is true if the .sql migration file has a +goose NO TRANSACTION annotation
	// or the .go migration file calls AddMigrationNoTx.
	Tx bool
	// UpCount is the number of statements in the Up migration.
	UpCount int
	// DownCount is the number of statements in the Down migration.
	DownCount int
}

Stats contains the stats for a migration file.

func GatherStats

func GatherStats(fw FileWalker, debug bool) ([]*Stats, error)

GatherStats returns the migration file stats.

Source Files

migration_go.go migration_sql.go migrationstats.go

Directories

PathSynopsis
internal/migrationstats/migrationstatsos
Version
v3.15.0
Published
Aug 13, 2023
Platform
linux/amd64
Imports
10 packages
Last checked
1 hour ago

Tools for package owners.