util.go
func genOptions(q url.Values, joiner, assign, sep, valSep string, skipWhenEmpty bool, ignore ...string) string {
	qlen := len(q)
	if qlen == 0 {
		return ""
	}

	// make ignore map
	ig := make(map[string]bool, len(ignore))
	for _, v := range ignore {
		ig[strings.ToLower(v)] = true
	}

	// sort keys
	s := make([]string, len(q))
	var i int
	for k := range q {
		s[i] = k
		i++
	}
	sort.Strings(s)

	var opts []string
	for _, k := range s {
		if !ig[strings.ToLower(k)] {
			val := strings.Join(q[k], valSep)
			if !skipWhenEmpty || val != "" {
				if val != "" {
					val = assign + val
				}
				opts = append(opts, k+val)
			}
		}
	}

	if len(opts) != 0 {
		return joiner + strings.Join(opts, sep)
	}

	return ""
}
func genOptions(q url.Values, joiner, assign, sep, valSep string, skipWhenEmpty bool, ignore ...string) string {
	qlen := len(q)
	if qlen == 0 {
		return ""
	}

	// make ignore map
	ig := make(map[string]bool, len(ignore))
	for _, v := range ignore {
		ig[strings.ToLower(v)] = true
	}

	// sort keys
	s := make([]string, len(q))
	var i int
	for k := range q {
		s[i] = k
		i++
	}
	sort.Strings(s)

	var opts []string
	for _, k := range s {
		if !ig[strings.ToLower(k)] {
			val := strings.Join(q[k], valSep)
			if !skipWhenEmpty || val != "" {
				if val != "" {
					val = assign + val
				}
				opts = append(opts, k+val)
			}
		}
	}

	if len(opts) != 0 {
		return joiner + strings.Join(opts, sep)
	}

	return ""
}
func genOptions ( q url . Values , joiner , assign , sep , valSep string , skipWhenEmpty bool , ignore ... string ) string { qlen := len ( q ) if qlen == 0 { return " " } // make ignore map ig := make ( map [ string ] bool , len ( ignore ) ) for _ , v := range ignore { ig [ strings . ToLower ( v ) ] = true } // sort keys s := make ( [ ] string , len ( q ) ) var i int for k := range q { s [ i ] = k i ++ } sort . Strings ( s ) var opts [ ] string for _ , k := range s { if ! ig [ strings . ToLower ( k ) ] { val := strings . Join ( q [ k ] , valSep ) if ! skipWhenEmpty || val != " " { if val != " " { val = assign + val } opts = append ( opts , k + val ) } } } if len ( opts ) != 0 { return joiner + strings . Join ( opts , sep ) } return " " }
// genOptions takes URL values and generates options, joining together with
// joiner, and separated by sep, with any multi URL values joined by valSep,
// ignoring any values with keys in ignore.
//
// For example, to build a "ODBC" style connection string, use like the following:
//     genOptions(u.Query(), "", "=", ";", ",")
genOptions takes URL values and generates options joining together with joiner and separated by sep with any multi URL values joined by valSep ignoring any values with keys in ignore . For example to build a ODBC style connection string use like the following : genOptions ( u . Query () = ; )