{"modulePath":"github.com/objectundefined/cockroach","version":"v0.0.0-20160624191317-5695764788c5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sqlutils\n\n## Functions\n\n```go\nfunc CreateTable(\n\tt *testing.T, sqlDB *gosql.DB, tableName, schema string, numRows int, fn GenRowFn,\n)\n```\nCreateTable creates a table in the \"test\" database with the given number of rows and using the given row generation function.\n\n```go\nfunc IntToEnglish(val int) string\n```\nIntToEnglish returns an English (pilot style) string for the given integer, for example:\n\n\tIntToEnglish(135) = \"one-three-five\"\n\n```go\nfunc PGUrl(t testing.TB, servingAddr, user, prefix string) (url.URL, func())\n```\nPGUrl 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.\n\nIn 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.\n\nArgs:\n\n\tprefix: A prefix to be prepended to the temp file names generated, for debugging.\n\n```go\nfunc RowEnglishFn(row int) parser.Datum\n```\nRowEnglishFn is a GenValueFn which returns an English representation of the row number, as a DString\n\n```go\nfunc RowIdxFn(row int) parser.Datum\n```\nRowIdxFn is a GenValueFn that returns the row number as a DInt\n\n```go\nfunc SetupServer(t *testing.T) (\n\tserver testingshim.TestServerInterface, goDB *gosql.DB, kvClient *client.DB, cleanupFn func(),\n)\n```\nSetupServer creates a test server with default parameters and sets up a gosql DB connection.\n\n```go\nfunc SetupServerWithParams(t *testing.T, params testingshim.TestServerParams) (\n\tserver testingshim.TestServerInterface, goDB *gosql.DB, kvClient *client.DB, cleanupFn func(),\n)\n```\nSetupServerWithParams creates a test server with the given params and sets up a gosql DB connection.\n\n## Types\n\n```go\ntype GenRowFn func(row int) []parser.Datum\n```\nGenRowFn 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.\n\n```go\nfunc ToRowFn(fn ...GenValueFn) GenRowFn\n```\nToRowFn creates a GenRowFn that returns rows of values generated by the given GenValueFns (one per column).\n\n```go\ntype GenValueFn func(row int) parser.Datum\n```\nGenValueFn 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.\n\n```go\nfunc RowModuloFn(modulo int) GenValueFn\n```\nRowModuloFn creates a GenValueFn that returns the row number modulo a given value as a DInt\n\n","path":"github.com/objectundefined/cockroach/testutils/sqlutils","name":"sqlutils","synopsis":"","isRedistributable":true}
