Documentation ¶
Index ¶
- type Shot
- func (shot Shot) GetQuery(query string, testName string, params []bigquery.QueryParameter) (string, error)
- func (shot Shot) GetTestResults(query string, testName string, params []bigquery.QueryParameter, ...) (interface{}, interface{}, error)
- func (shot Shot) RunQuery(query string, testName string, params []bigquery.QueryParameter, ...) ([]interface{}, error)
- func (shot Shot) RunTest(query string, testName string, params []bigquery.QueryParameter) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Shot ¶
type Shot struct {
// contains filtered or unexported fields
}
Shot is used to load queries and run tests for them
func NewShotWithClient ¶ added in v0.0.19
func (Shot) GetQuery ¶ added in v0.0.18
func (shot Shot) GetQuery(query string, testName string, params []bigquery.QueryParameter) (string, error)
GetQuery returns the SQL query query is the name of the query. There must be a correponding yaml definition file and an SQL template in the filesystem. testName is the name of the test to run, it must appear in the yaml definition file params are BigQuery paramaters
func (Shot) GetTestResults ¶ added in v0.1.2
func (shot Shot) GetTestResults(query string, testName string, params []bigquery.QueryParameter, row interface{}) (interface{}, interface{}, error)
GetTestResults performs a test by running two SQL queries: Query 1: The test query Query 2: The exptected result query query is the name of the query. There must be a correponding yaml definition file and an SQL template in the filesystem. testName is the name of the test to run, it must appear in the yaml definition file params are BigQuery paramaters row is a variable of type to be read from the table (must adhere to https://pkg.go.dev/cloud.google.com/go/bigquery#RowIterator.Next requirements) The results will be two slices of the same type of 'row' with the result of each query (test and result)
func (Shot) RunQuery ¶ added in v0.0.16
func (shot Shot) RunQuery(query string, testName string, params []bigquery.QueryParameter, row interface{}) ([]interface{}, error)
RunQuery runs a single SQL query against BigQuery query is the name of the query. There must be a correponding yaml definition file and an SQL template in the filesystem. testName is the name of the test to run, it must appear in the yaml definition file params are BigQuery paramaters row is a variable of type to be read from the table (must adhere to https://pkg.go.dev/cloud.google.com/go/bigquery#RowIterator.Next requirements) The result will be a slice of the same type of 'row' with the result of the query
func (Shot) RunTest ¶
func (shot Shot) RunTest(query string, testName string, params []bigquery.QueryParameter) (bool, error)
GetTestResults performs a test by running a single [SQL query](queries/diff/diff.sql) Note that due it doesn't detect differences if tables have duplicate rows.
query is the name of the query. There must be a correponding yaml definition file and an SQL template in the filesystem. testName is the name of the test to run, it must appear in the yaml definition file params are BigQuery paramaters The result will true iff the result is empty