Documentation
¶
Overview ¶
Package querystringlite is a faithful port of Node.js's built-in querystring module for flat (non-nested) query strings.
Parsing splits on "&" and "=", treats "+" as a space, and percent-decodes keys and values. Stringifying percent-encodes keys and values (encoding spaces as "%20", matching Node) and repeats keys for multi-valued entries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Escape ¶
Escape percent-encodes s the way Node's querystring.escape does. Spaces are encoded as "%20".
func Parse ¶
Parse parses a URL query string into a map of keys to their values. A key that appears multiple times (as in "a=1&a=3") maps to all of its values in order. A segment without "=" maps the key to a single empty-string value.
func ParseSingle ¶
ParseSingle is a convenience wrapper around Parse that keeps only the first value seen for each key.
func Stringify ¶
Stringify serializes a map of keys to values into a query string. Keys are emitted in sorted order for determinism; multi-valued keys are emitted as repeated "key=value" pairs. A key with no values is omitted.
func StringifySingle ¶
StringifySingle is a convenience wrapper around Stringify for maps with a single value per key.
Types ¶
This section is empty.