Documentation ¶
Index ¶
- func DatabaseName(u *url.URL) string
- func MustClose(c io.Closer)
- func MustParseURL(s string) *url.URL
- func MustUnescapePath(s string) string
- func QueryColumn(db Transaction, query string, args ...interface{}) ([]string, error)
- func QueryValue(db Transaction, query string, args ...interface{}) (string, error)
- func RunCommand(name string, args ...string) ([]byte, error)
- func TrimLeadingSQLComments(data []byte) ([]byte, error)
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DatabaseName ¶
DatabaseName returns the database name from a URL
func MustParseURL ¶
MustParseURL parses a URL from string, and panics if it fails. It is used during testing and in cases where we are parsing a generated URL.
func MustUnescapePath ¶ added in v1.14.0
MustUnescapePath unescapes a URL path, and panics if it fails. It is used during in cases where we are parsing a generated path.
func QueryColumn ¶
func QueryColumn(db Transaction, query string, args ...interface{}) ([]string, error)
QueryColumn runs a SQL statement and returns a slice of strings it is assumed that the statement returns only one column e.g. schema_migrations table
func QueryValue ¶
func QueryValue(db Transaction, query string, args ...interface{}) (string, error)
QueryValue runs a SQL statement and returns a single string it is assumed that the statement returns only one row and one column sql NULL is returned as empty string
func RunCommand ¶
RunCommand runs a command and returns the stdout if successful
func TrimLeadingSQLComments ¶
TrimLeadingSQLComments removes sql comments and blank lines from the beginning of text generally when performing sql dumps these contain host-specific information such as client/server version numbers