Documentation ¶
Index ¶
- func CreateTable(t *testing.T, sqlDB *gosql.DB, tableName, schema string, numRows int, ...)
- func IntToEnglish(val int) string
- func PGUrl(t testing.TB, servingAddr, user, prefix string) (url.URL, func())
- func RowEnglishFn(row int) parser.Datum
- func RowIdxFn(row int) parser.Datum
- func SetupServer(t *testing.T) (server testingshim.TestServerInterface, goDB *gosql.DB, kvClient *client.DB, ...)
- func SetupServerWithParams(t *testing.T, params testingshim.TestServerParams) (server testingshim.TestServerInterface, goDB *gosql.DB, kvClient *client.DB, ...)
- type GenRowFn
- type GenValueFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTable ¶
func CreateTable( t *testing.T, sqlDB *gosql.DB, tableName, schema string, numRows int, fn GenRowFn, )
CreateTable creates a table in the "test" database with the given number of rows and using the given row generation function.
func IntToEnglish ¶
IntToEnglish returns an English (pilot style) string for the given integer, for example:
IntToEnglish(135) = "one-three-five"
func PGUrl ¶
PGUrl returns a postgres connection url which connects to this server with the given user, and a cleanup function which must be called after all connections created using the connection url have been closed.
In order to connect securely using postgres, this method will create temporary on-disk copies of certain embedded security certificates. The certificates will be created in a new temporary directory. The returned cleanup function will delete this temporary directory. Note that two calls to this function for the same `user` will generate different copies of the certificates, so the cleanup function must always be called.
Args:
prefix: A prefix to be prepended to the temp file names generated, for debugging.
func RowEnglishFn ¶
RowEnglishFn is a GenValueFn which returns an English representation of the row number, as a DString
func SetupServer ¶
func SetupServer(t *testing.T) ( server testingshim.TestServerInterface, goDB *gosql.DB, kvClient *client.DB, cleanupFn func(), )
SetupServer creates a test server with default parameters and sets up a gosql DB connection.
func SetupServerWithParams ¶
func SetupServerWithParams(t *testing.T, params testingshim.TestServerParams) ( server testingshim.TestServerInterface, goDB *gosql.DB, kvClient *client.DB, cleanupFn func(), )
SetupServerWithParams creates a test server with the given params and sets up a gosql DB connection.
Types ¶
type GenRowFn ¶
GenRowFn is a function that takes a (1-based) row index and returns a row of Datums that will be converted to strings to form part of an INSERT statement.
func ToRowFn ¶
func ToRowFn(fn ...GenValueFn) GenRowFn
ToRowFn creates a GenRowFn that returns rows of values generated by the given GenValueFns (one per column).
type GenValueFn ¶
GenValueFn is a function that takes a (1-based) row index and returns a Datum which will be converted to a string to form part of an INSERT statement.
func RowModuloFn ¶
func RowModuloFn(modulo int) GenValueFn
RowModuloFn creates a GenValueFn that returns the row number modulo a given value as a DInt