queryparam

package
v2.39.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 2 Imported by: 13 modules, 40 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package queryparam provides utilities for efficiently working with query parameters in URLs. It focuses on zero allocation URL query parameter lookups.

func handler(w http.ResponseWriter, r *http.Request) {
	// Get the value of the `key` query parameter.
	value := queryparam.Get(r.URL.RawQuery, "key")
}

Note that this method does not support multiple values for the same key, so using `val=1,2,3` is preferable to `val=1&val=2&val=3`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(query, name string) string

Get a query param by name without any dynamic allocations. For small numbers of query params, it is faster to call this method multiple times than to use `url.ParseQuery` and then call `Get` on the resulting `url.Values`. This method does not support multiple values for the same key, so using `val=1,2,3` is preferable to `val=1&val=2&val=3`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL