Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator produces SQL SELECT statements that reference the TPC-C schema. All generated queries are read-only; data integrity is maintained by the setup phase in Validator.
func NewGenerator ¶
NewGenerator creates a Generator that uses the given LCG for randomness.
type LCG ¶
type LCG struct {
// contains filtered or unexported fields
}
LCG implements a Linear Congruential Generator using Knuth MMIX parameters for a deterministic, reproducible pseudo-random number stream.
Parameters:
Multiplier: 6364136223846793005 Increment: 1442695040888963407 Modulus: 2^64 (implicit via uint64 overflow)
func (*LCG) Choice ¶
Choice returns a uniformly random element from items. Returns "" if items is empty.
type Mismatch ¶
type Mismatch struct {
Query string
SQLiteResult QueryResult
SQLVibeResult QueryResult
Reason string
}
Mismatch describes a single discrepancy found by the validator.
func Compare ¶
func Compare(query string, liteRes, svibeRes QueryResult) *Mismatch
Compare returns a Mismatch if the two results differ, or nil if they match.
Comparison rules:
- Both error → match (we don't compare error message text).
- One error, other success → mismatch.
- Both success → rows are sorted and compared cell-by-cell with float tolerance; NULL == NULL is true.
type QueryResult ¶
type QueryResult struct {
// Columns is nil for non-SELECT statements.
Columns []string
// Rows holds the result rows; each row is a slice of Go values
// (int64, float64, string, or nil for NULL).
Rows [][]interface{}
// Err is non-nil when the statement caused an error.
Err error
}
QueryResult holds the outcome of running a single SQL statement.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator runs the same SQL statements against both SQLite and sqlvibe and reports any result mismatches.
func NewValidator ¶
NewValidator creates a Validator with the given LCG seed. Both SQLite and sqlvibe databases are created in-memory and seeded with the TPC-C starter dataset.
func (*Validator) Close ¶
func (v *Validator) Close()
Close releases all resources held by the Validator.
func (*Validator) Run ¶
func (v *Validator) Run(n int, onMatch func(idx int, query string, liteRes, svibeRes QueryResult)) ([]Mismatch, error)
Run generates n random SQL statements, executes each against both backends, and collects any mismatches. It calls onMatch after each execution to allow immediate result checking.