Created from the plain text reference card on orgmode.org Download this file, and open it in Emacs org-mode!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns the individual fields for a dsn, or an error | |
func ParseDSN(input string) (error error, host string, port string, user string, password string, database string) { | |
args := strings.Split(string(input), ",") | |
if len(args) < 1 { | |
return errors.New("Seems like " + string(input) + " is not a valid dsn"), "", "", "", "", "" | |
} | |
for i := 0; i < len(args); i++ { | |
tmp := strings.Split(args[i], "=") | |
if len(tmp) < 2 { | |
return errors.New("I can't parse " + args[i]), "", "", "", "", "" |