Ejemplo n.º 1
0
func mysqlOpener(url *config.URL) (driver.Driver, error) {
	url.Query["charset"] = "UTF8"
	url.Query["sql_mode"] = "ANSI"
	url.Query["parseTime"] = "true"
	url.Query["loc"] = "UTC"
	url.Query["clientFoundRows"] = "true"
	return sql.NewDriver(mysqlBackend, url)
}
Ejemplo n.º 2
0
func sqliteOpener(url *config.URL) (driver.Driver, error) {
	drv, err := sql.NewDriver(sqliteBackend, url)
	if err == nil {
		db := drv.DB()
		if _, err := db.Exec("PRAGMA foreign_keys = on"); err != nil {
			return nil, err
		}
		if _, err := db.Exec("PRAGMA journal_mode = WAL"); err != nil {
			return nil, err
		}
	}
	return drv, err
}
Ejemplo n.º 3
0
func postgresOpener(url *config.URL) (driver.Driver, error) {
	return sql.NewDriver(postgresBackend, url)
}