mysql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2017 License: MIT Imports: 2 Imported by: 0

README

MySQL

The MySQL dialect uses the github.com/go-sql-driver/mysql driver, which passes the compatibility test suite.

By default, this MySQL dialect will parse DATE and DATETIME columns into []byte or string types. Support for time.Time must be explicitly enabled by adding the parseTime=true parameter to the connection string.

Testing

A valid MySQL connection string should be set on the environmental variable SOL_TEST_MYSQL. An example:

user:pass@tcp(host:port)/db?parseTime=true

This variable can be given inline:

SOL_TEST_MYSQL="user:pass@tcp(host:port)/db?parseTime=true" go test

If the environmental variable is empty, the test will default to a Travis CI connection string, which will likely panic on your local system.

Docker

Docker hub provides an official MySQL image. A container can be started with:

docker run -p 3306:3306 --name mysql -e "MYSQL_ROOT_PASSWORD=" \
-e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" \
-e "MYSQL_DATABASE=sol_test" -d mysql:latest

Then change the host of the connection string to the default Docker machine and run tests, for example:

SOL_TEST_MYSQL="root@tcp(<DOCKER HOST>:3306)/sol_test?parseTime=true" go test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

type MySQL struct{}

MySQL implements the Dialect interface for MySQL databases.

func Dialect

func Dialect() *MySQL

Dialect is a constructor for the MySQL Dialect

func (*MySQL) Param

func (d *MySQL) Param(i int) string

Param returns the MySQL specific parameterization scheme.

Jump to

Keyboard shortcuts

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