// GenCosmos generates a azure cosmos DSN from the passed URL.
GenCosmos generates a azure cosmos DSN from the passed URL.
// GenCosmos generates a azure cosmos DSN from the passed URL .
func GenCosmos(u *URL) (string, error) {
	host, port, dbname := u.Hostname(), u.Port(), strings.TrimPrefix(u.Path, "/")
	if port != "" {
		port = ":" + port
	}
	q := u.Query()
	q.Set("AccountEndpoint", "https://"+host+port)
	if u.User == nil {
		return "", ErrMissingUser
	}
	q.Set("AccountKey", u.User.Username())
	if dbname != "" {
		q.Set("Db", dbname)
	}
	return genOptionsODBC(q, true), nil
}
func GenCosmos ( u * URL ) ( string , error ) { host , port , dbname := u . Hostname ( ) , u . Port ( ) , strings . TrimPrefix ( u . Path , " " ) if port != " " { port = " " + port } q := u . Query ( ) q . Set ( " " , " " + host + port ) if u . User == nil { return " " , ErrMissingUser } q . Set ( " " , u . User . Username ( ) ) if dbname != " " { q . Set ( " " , dbname ) } return genOptionsODBC ( q , true ) , nil }
GenCosmos generates a azure cosmos DSN from the passed URL.
GenCosmos generates a azure cosmos DSN from the passed URL .
// add user/pass