commit | d6a1024d386f274c27b1d6116c856a02abba11d8 | [log] [tgz] |
---|---|---|
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | Mon Sep 04 13:48:31 2023 |
committer | Will Norris <will@willnorris.com> | Thu Mar 07 20:19:14 2024 |
tree | 97835539ac4ac4f95dc68025eb4c357ec50a507d | |
parent | 7af347edbb9773d18095738a7eae8b20f09174ec [diff] |
go.mod,.github: update dependencies This merges together all of the various PRs opened by dependabot. Signed-off-by: Will Norris <will@tailscale.com>
go-querystring is a Go library for encoding structs into URL query parameters.
import "github.com/google/go-querystring/query"
go-querystring is designed to assist in scenarios where you want to construct a URL using a struct that represents the URL query parameters. You might do this to enforce the type safety of your parameters, for example, as is done in the go-github library.
The query package exports a single Values()
function. A simple example:
type Options struct { Query string `url:"q"` ShowAll bool `url:"all"` Page int `url:"page"` } opt := Options{ "foo", true, 2 } v, _ := query.Values(opt) fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
See the package godocs for complete documentation on supported types and formatting options.
If you are looking for a library that can both encode and decode query strings, you might consider one of these alternatives: