You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- psql -c 'CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "pg_trgm";' -U postgres -d travis_ci_test
4
+
- psql -c 'create database sol_test;' -U postgres
5
+
- psql -c 'CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "pg_trgm";' -U postgres -d sol_test
The MySQL dialect uses the [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) driver, which [passes the compatibility test suite](https://github.com/golang/go/wiki/SQLDrivers).
4
+
5
+
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.
6
+
7
+
### Testing
8
+
9
+
A valid MySQL connection string should be set on the environmental variable `SOL_TEST_MYSQL`. An example:
10
+
11
+
user:pass@tcp(host:port)/db?parseTime=true
12
+
13
+
This variable can be given inline:
14
+
15
+
SOL_TEST_MYSQL="user:pass@tcp(host:port)/db?parseTime=true" go test -run=TestMySQL
16
+
17
+
If the environmental variable is not given, it will default to a [Travis CI](https://docs.travis-ci.com/user/database-setup/#MySQL) connection string, which will likely panic on your local system.
18
+
19
+
#### Docker
20
+
21
+
Docker hub provides an [official MySQL image](https://hub.docker.com/_/mysql/). A container can be started with:
22
+
23
+
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
24
+
25
+
26
+
Tests can then be running by supplying the host IP of the default Docker in the environmental variable credential string, such as:
27
+
28
+
SOL_TEST_MYSQL="root@tcp(host:3306)/sol_test?parseTime=true" go test
0 commit comments