Documentation ¶
Index ¶
- Constants
- func ExcludeColumns(columns ...string) optionFunc
- func ExcludeSchemas(schemas ...string) optionFunc
- func ExcludeTables(tables ...string) optionFunc
- func IncludeColumns(columns ...string) optionFunc
- func IncludeSchemas(schemas ...string) optionFunc
- func IncludeTables(tables ...string) optionFunc
- func WithAliases(aliases []string) optionFunc
- func WithBookendLimit(limit int) optionFunc
- func WithLogger(logger log.FieldLogger) optionFunc
- func WithSparseMod(mod int) optionFunc
- func WithTests(testModes ...string) optionFunc
- func WithTimestampPrecision(precision string) optionFunc
- type Config
- type Option
- type Results
- type SingleResult
Constants ¶
const ( // A full test is the default test mode. It is the only test mode that checks all // of the rows of a given table, guaranteeing equivalent values between targets. TestModeFull = "full" // The bookend test is similar to the full test mode, but it only checks a certain // number of rows from the beginning and end of the table, sorted by primary key. TestModeBookend = "bookend" // The number of rows checked in the bookend test mode is configurable. TestModeBookendDefaultLimit = 1000 // A sparse test checks a deterministic subset of the rows in a table. TestModeSparse = "sparse" // The number of rows checked in the sparse test mode is configurable, // equalling approximately 1/mod of the total. TestModeSparseDefaultMod = 10 // A rowcount test simply compares table row counts between targets. TestModeRowCount = "rowcount" TimestampPrecisionMilliseconds = "milliseconds" )
Variables ¶
This section is empty.
Functions ¶
func ExcludeColumns ¶
func ExcludeColumns(columns ...string) optionFunc
ExcludeColumns sets the exclude columns configuration.
func ExcludeSchemas ¶
func ExcludeSchemas(schemas ...string) optionFunc
ExcludeSchemas sets the exclude schemas configuration.
func ExcludeTables ¶
func ExcludeTables(tables ...string) optionFunc
ExcludeTables sets the exclude tables configuration.
func IncludeColumns ¶
func IncludeColumns(columns ...string) optionFunc
IncludeColumns sets the include columns configuration.
func IncludeSchemas ¶
func IncludeSchemas(schemas ...string) optionFunc
IncludeSchemas sets the include schemas configuration.
func IncludeTables ¶
func IncludeTables(tables ...string) optionFunc
IncludeTables sets the include tables configuration.
func WithAliases ¶
func WithAliases(aliases []string) optionFunc
WithAliases sets the aliases for the target databases. Is ignored if not equal to the number of targets.
func WithBookendLimit ¶
func WithBookendLimit(limit int) optionFunc
WithBookendLimit sets the bookend limit configuration used in the bookend test mode.
func WithLogger ¶
func WithLogger(logger log.FieldLogger) optionFunc
WithLogger sets the logger configuration.
func WithSparseMod ¶
func WithSparseMod(mod int) optionFunc
WithSparseMod sets the sparse mod configuration used in the sparse test mode.
func WithTimestampPrecision ¶
func WithTimestampPrecision(precision string) optionFunc
WithTimestampPrecision sets the precision level to use when comparing timestamp values. This can be useful for addressing precision differences between engines, i.e. millisecond vs. microsecond.
Types ¶
type Config ¶
type Config struct { // Filters for which schemas and tables to run verification tests on. // Exclude overrides Include. IncludeTables []string ExcludeTables []string IncludeSchemas []string ExcludeSchemas []string IncludeColumns []string ExcludeColumns []string // TestModes is a list of test modes to run, executed in order. TestModes []string // BookendLimit is the number of rows to include when running a bookend test. BookendLimit int // SparseMod is used in the sparse test mode to deterministically select a // subset of rows, approximately 1/mod of the total. SparseMod int // Aliases is a list of aliases to use for the target databases in reporting // output. Is ignored if the number of aliases is not equal to the number of // supplied targets. Aliases []string // TimestampPrecision is the precision level to use when comparing timestamp values. TimestampPrecision string Logger log.FieldLogger }
Config represents the configuration for running a verification.
func NewConfig ¶
NewConfig returns a new Config with default values overridden by the supplied Options.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option interface used for setting optional config properties.
type Results ¶
type Results struct {
// contains filtered or unexported fields
}
Results stores the results from tests run in a verification. It is accessed from the per-target goroutines and is designed to be thread-safe.
func NewResults ¶
NewResults creates a new Results object, configured with the output-formatted names of the targets and list of test modes ran.
func Verify ¶
Verify runs all verification tests for the given table, configured by the supplied Options.
func (*Results) AddResult ¶
func (r *Results) AddResult(targetName string, schemaTableHashes SingleResult)
AddResult adds a SingleResult from a test on a specific target to the Results object.
func (Results) CheckForErrors ¶
CheckForErrors checks for and returns a list of any errors found by comparing test outputs.
func (Results) WriteAsTable ¶
WriteAsTable writes the results as a table to the given io.Writer.