Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

go-querystring is Go library for encoding structs into URL query strings.

License

NotificationsYou must be signed in to change notification settings

google/go-querystring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Go ReferenceTest StatusTest Coverage

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 aURL using a struct that represents the URL query parameters. You might do thisto enforce the type safety of your parameters, for example, as is done in thego-github library.

The query package exports a singleValues() function. A simple example:

typeOptionsstruct {Querystring`url:"q"`ShowAllbool`url:"all"`Pageint`url:"page"`}opt:=Options{"foo",true,2 }v,_:=query.Values(opt)fmt.Print(v.Encode())// will output: "q=foo&all=true&page=2"

See thepackage godocs for complete documentation on supported types andformatting options.

Alternatives

If you are looking for a library that can both encode and decode query strings,you might consider one of these alternatives:


[8]ページ先頭

©2009-2025 Movatter.jp