Bancoche (SQL Runner)
Package: github.com/wrapped-owls/testereiro/puppetest/pkg/atores/bancoche
bancoche runs SQL queries and validates rows.
| |
WithMapQuery(table, filter)WithMapQueryFromCtx(table, fn)WithQuery(bancoche.NewRawQuery(query, args...))
ExpectCount(expected, countRows)WithCustomValidation(func(t testing.TB, rows *sql.Rows) error)
WithCustomValidation is useful when row scanning logic is domain-specific.
ExpectCount behavior:
countRows=true: counts the number of returned rows.countRows=false: expects the query to return aCOUNT(*)-style single value and scans it.