Skip to content
Node: querystring.stringify(obj)github.com/sahilkhaire/gox/url

EncodeQuery

Overview

EncodeQuery encodes values (querystring.stringify).

If you are coming from Node.js, the closest pattern is querystring.stringify(obj).

Signature

go
func EncodeQuery(v url.Values) string

Compare: Node.js · Standard Go · gox

js
querystring.stringify(obj)
go
vals, err := url.ParseQuery(q)
// or url.Values.Encode()
go
import "github.com/sahilkhaire/gox/url"

url.EncodeQuery(obj)

Example

go
import "github.com/sahilkhaire/gox/url"

url.EncodeQuery(obj)

Tips

Import github.com/sahilkhaire/gox/url and call EncodeQuery directly. See the comparison below for the standard library equivalent.

Standard library alternative

Use the standard library directly:

go
vals, err := url.ParseQuery(q)
// or url.Values.Encode()

Back to url package overview

MIT Licensed · Built for Node.js developers moving to Go