Exemple #1
0
func (MySQL) DSN(host, port, username, password, dbname string, cfg map[string]string) string {
	return fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?%s",
		username,
		password,
		host,
		port,
		dbname,
		strings2.JoinPairs(cfg, "=", "&"),
	)
}
Exemple #2
0
func (Postgres) DSN(host, port, username, password, dbname string, cfg map[string]string) string {
	return fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s %s",
		username,
		password,
		host,
		port,
		dbname,
		strings2.JoinPairs(cfg, "=", " "),
	)
}