mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-06-13 05:29:24 -04:00
Get all current tests to pass with MySQL
This is done by requiring 'parseTime=true' in the MySQL DSN's (required by github.com/go-sql-driver/mysql when Scan()ing to time.Time's), and not forcing update counts to match if rows were updated to what they already were.
This commit is contained in:
@ -9,6 +9,8 @@ import (
|
||||
_ "github.com/lib/pq"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"gopkg.in/gorp.v1"
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetDbMap(db *sql.DB, dbtype config.DbType) (*gorp.DbMap, error) {
|
||||
@ -43,3 +45,10 @@ func GetDbMap(db *sql.DB, dbtype config.DbType) (*gorp.DbMap, error) {
|
||||
|
||||
return dbmap, nil
|
||||
}
|
||||
|
||||
func GetDSN(dbtype config.DbType, dsn string) string {
|
||||
if dbtype == config.MySQL && !strings.Contains(dsn, "parseTime=true") {
|
||||
log.Fatalf("The DSN for MySQL MUST contain 'parseTime=True' but does not!")
|
||||
}
|
||||
return dsn
|
||||
}
|
||||
|
Reference in New Issue
Block a user