Documentation
¶
Overview ¶
Package testdb creates new databases for tests.
Created databases may use either sqlite (default) or mysql as the database driver. The default driver can be overridden via the TRILLIAN_SQL_DRIVER environment variable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Provider ¶
type Provider struct {
// Driver is the SQL driver name used for sql.Open (e.g.: "mysql" or "sqlite3").
Driver string
// DataSourceName is the data source name used for sql.Open (e.g., the database URL).
DataSourceName string
// CreateDataSource controls whether a new, random data source is created.
// If set the true, New() firstly connects to DataSourceName, creates a randomly-generated
// database (via "CREATE DATABASE") and then connects to the new database.
// Useful to create random databases via a "main" data source name.
CreateDataSource bool
}
Provider is an object capable of creating new test databases.
func MySQL ¶
func MySQL() *Provider
MySQL returns a MySQL database provider. The database must be running locally and have a root user without password.
Click to show internal directories.
Click to hide internal directories.