/
View dependency graph
Depends on
- dh-golang (dh-sequence-golang)
- golang-defaults (golang-any)
- golang-github-google-go-cmp (golang-github-google-go-cmp-dev)
- debhelper-compat
Used by
- crowdsec 1.4.6-10.1
- golang-github-cyberdelia-heroku-go 5.5.0-1
- golang-github-dghubble-sling 1.3.0-1
- golang-github-digitalocean-godo 1.37.0-2
- golang-github-dnsimple-dnsimple-go 2.0.0-2
- golang-github-dreamitgetit-statuscake 0.0~git20220607.de57c59-1
- golang-github-gambol99-go-marathon 0.7.1-1.1
- golang-github-google-go-github 60.0.0-1
- golang-github-kong-go-kong 0.15.0-1
- golang-github-linbit-golinstor 0.63.0-1
- golang-github-linode-linodego 1.55.0-1
- golang-github-mimuret-golang-iij-dpf 0.9.1-2
- golang-github-ncw-go-acd 0.0~git20171120.887eb06-2
- golang-github-vultr-govultr 2.17.2-2
- golang-github-xanzy-go-gitlab 0.110.0-1
- golang-github-xenolf-lego 4.35.2-2
- golang-gitlab-gitlab-org-api-client-go 0.123.0-2
- golang-github-cyberdelia-heroku-go 5.5.0-2
- golang-github-google-go-github 60.0.0-2
- golang-github-xenolf-lego 4.35.2-3
README (full)
go-querystring
go-querystring is a Go library for encoding structs into URL query parameters.
Usage
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.
Alternatives
If you are looking for a library that can both encode and decode query strings, you might consider one of these alternatives:
- https://github.com/gorilla/schema
- https://github.com/pasztorpisti/qs
- https://github.com/hetiansu5/urlquery
- https://github.com/ggicci/httpin (decoder only)
| dir | .github/ |
| dir | debian/ |
| dir | query/ |
| file | .gitignore |
| file | .golangci.yml |
| file | CONTRIBUTING.md |
| file | LICENSE |
| file | README.md |
| file | go.mod |
| file | go.sum |