/**
 * Appends the given set of parameters to the given query string
 * @param	string	queryBuilder	The query url string to append the parameters
 * @param	map     parameters	The parameters to append
 * @return	void
 */
Appends the given set of parameters to the given query string
@param	string	queryBuilder	The query url string to append the parameters
@param	map     parameters	The parameters to append
@return	void
/ ** * Appends the given set of parameters to the given query string * @param string queryBuilder The query url string to append the parameters * @param map parameters The parameters to append * @return void * /
func AppendUrlWithQueryParameters(queryBuilder string, parameters map[string]interface{}) (string, error) {
    if (len(queryBuilder) < 1) {
        return queryBuilder, errors.New("Given value for parameter \"queryBuilder\" is invalid.")
    }
    if (len(parameters) < 1) {
        return queryBuilder, nil;
    }
    hasParams := (strings.Index(queryBuilder, "?") > 0)
    var buf bytes.Buffer
    buf.WriteString(queryBuilder)
    for key, value := range parameters {
        if(value == nil) {
            continue
        }
        var toAppend string
        if reflect.TypeOf(value).Kind() == reflect.Slice {
            toAppend = arrayToQuery(key, value)
        } else {
            strVal := unirest.ToString(value, "")
            if(len(strVal) > 0){
                toAppend = url.QueryEscape(key) + "=" + url.QueryEscape(strVal)
            }
        }
        if(len(toAppend) < 1) {
            continue
        }
        if(hasParams){
            buf.WriteString("&")
        } else {
            buf.WriteString("?")
        }
        hasParams = true
        buf.WriteString(toAppend)
    }
    return buf.String(), nil
}
func AppendUrlWithQueryParameters ( queryBuilder string , parameters map [ string ] interface { } ) ( string , error ) { if ( len ( queryBuilder ) < 1 ) { return queryBuilder , errors . New ( " \" \" " ) } if ( len ( parameters ) < 1 ) { return queryBuilder , nil ; } hasParams := ( strings . Index ( queryBuilder , " " ) > 0 ) var buf bytes . Buffer buf . WriteString ( queryBuilder ) for key , value := range parameters { if ( value == nil ) { continue } var toAppend string if reflect . TypeOf ( value ) . Kind ( ) == reflect . Slice { toAppend = arrayToQuery ( key , value ) } else { strVal := unirest . ToString ( value , " " ) if ( len ( strVal ) > 0 ) { toAppend = url . QueryEscape ( key ) + " " + url . QueryEscape ( strVal ) } } if ( len ( toAppend ) < 1 ) { continue } if ( hasParams ) { buf . WriteString ( " " ) } else { buf . WriteString ( " " ) } hasParams = true buf . WriteString ( toAppend ) } return buf . String ( ) , nil }
Appends the given set of parameters to the given query string
@param	string	queryBuilder	The query url string to append the parameters
@param	map     parameters	The parameters to append
@return	void
Appends the given set of parameters to the given query string @param string queryBuilder The query url string to append the parameters @param map parameters The parameters to append @return void
//perform parameter validation //does the query string already has parameters //iterate and append parameters //ignore null values //have something to append? //if already has parameters, use the &amp; to append new parameters //indicate that now the query has some params //append value