Documentation ¶
Index ¶
- func AssertConfigDatabaseExists()
- func AssertDatabaseExists(name string)
- func AssertUseConfigDatabase()
- func Close()
- func Commit()
- func CopyDatabase(source string, destination string, revision uint64)
- func CreateConfigDatabase()
- func CreateNewRevision(database string, file string, comment string)
- func DatabaseExists(name string) bool
- func Exec(sql string, params ...interface{}) (err error)
- func ExecMulti(sql string) (err error)
- func ExecUnsafe(sql string, params ...interface{}) (err error)
- func GenerateSchema(databaseName string) string
- func GetCurrentSchemaRevision(database string) uint64
- func GetDatabaseEncoding(databaseName string) (charSet string, collation string)
- func GetDownSql(database string, revision uint64) (downSql string)
- func GetHeadRevision(database string) uint64
- func GetLogEntries(database string) (log logEntries)
- func GetManagedDatabaseList() (list databaseList)
- func GetSchema(database string, revision uint64) (sql string)
- func GetUpdateSql(database string, revision uint64) (upSql string)
- func InitialiseDatabase(database string)
- func InsertRow(sql string, params ...interface{}) (insertId uint64, err error)
- func Open(config config.Config)
- func Query(sql string, params ...interface{}) (rows []mysql.Row, err error)
- func QueryRow(sql string, params ...interface{}) (row mysql.Row, err error)
- func QueryRowUnsafe(sql string, params ...interface{}) (row mysql.Row, err error)
- func QueryUnsafe(sql string, params ...interface{}) (rows []mysql.Row, err error)
- func Rollback()
- func SetConnectionEncoding(charSet string, collation string)
- func StartTransaction()
- func UpdateSchemaToRevision(database string, target uint64)
- func ValidateSchemaUpdate(database string, file string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertConfigDatabaseExists ¶
func AssertConfigDatabaseExists()
Check if the snap config database exists. if it doesn't, create it.
func AssertDatabaseExists ¶
func AssertDatabaseExists(name string)
Assert the a database exists. If not throw a fatal error.
func CopyDatabase ¶
Copy a full source database (sans data) to a new destination at a particular source revision.
func CreateConfigDatabase ¶
func CreateConfigDatabase()
Create the snap config database and all associated tables.
func CreateNewRevision ¶
Create a new revision for a managed database. This function applies the file and creates the new revision in the database.
func ExecMulti ¶
Execute a multi-statement query expecting no results. This is especially useful for executing many SQL statements in one go, such as applying DDL's to an existing schema.
func ExecUnsafe ¶
Execute an unsafe statement not expecting results. This function is used very similarly to the fmt.Sprintf function and all format specifiers are supported. Escaping of parameters is handled in the wrapped library.
func GenerateSchema ¶
Generate the full schema of the named database (not including data) in SQL format as a string. The format of the generated SQL is that which would be generated from the mysqldump tool.
func GetCurrentSchemaRevision ¶
Get the current schema revision of the passed database. The value returned will be different to the latest revision if the database has been rolled back using the update command.
func GetDatabaseEncoding ¶
Get the character encoding and collation of the passed database.
func GetDownSql ¶
Return the down SQL for the database and revision passed.
func GetHeadRevision ¶
Get the maximum revision of the passed database.
func GetLogEntries ¶
func GetLogEntries(database string) (log logEntries)
Get log entries for the passed database.
func GetManagedDatabaseList ¶
func GetManagedDatabaseList() (list databaseList)
List all managed databases.
func GetUpdateSql ¶
Return the update SQL for the database and revision passed. This function defaults to the full SQL if the update SQL doesn't exist. This is because when initialising a database (revision 1) only the full SQL is available.
func QueryRowUnsafe ¶
Execute an unsafe statement expecting a single row result. This function is used very similarly to the fmt.Sprintf function and all format specifiers are supported. Escaping of parameters is handled in the wrapped library.
func QueryUnsafe ¶
Execute an unsafe statement expecting multiple results. This function is used very similarly to the fmt.Sprintf function and all format specifiers are supported. Escaping of parameters is handled in the wrapped library.
func SetConnectionEncoding ¶
Set the connection encoding.
func UpdateSchemaToRevision ¶
Update the schema of a managed database to a previously committed revision.
func ValidateSchemaUpdate ¶
Validate that the schema file updates then correctly reverses any changes made.
Types ¶
This section is empty.