go-test-mysqld-goose

module
v0.0.0-...-e9ef376 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2014 License: MIT

README

go-test-mysql-goose

This packege is just a wrapper for go-test-mysqld and goose.

At first launch MySQL instance by go-test-mysqld, and then automatically deploy some SQLs by goose.

Examples

Following code launch MySQL instance with default settings, and deploy SQL migrations on ./db directory.

import (
    "github.com/typester/go-test-mysqld-goose/mysqltest"
    "path/filepath"
)

mysql, err := mysqltest.New(filepath.Join("db"))
if err != nil {
    panic(err)
}
defer mysql.Server.Stop()

This package also provides connection helper function Dns() for mymysql driver. To use this function, you can connect test mysql server very easily.

import (
    "database/sql"
    _"github.com/ziutek/mymysql/godrv"
)

db, err := db.Open("mymysql", mysql.Dns())
if err != nil {
    panic(err)
}
defer db.Close()

// use db

Notice

This package is made for my personal usage so that many features may lacks for others. Patches are very appreciated.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL