diff options
Diffstat (limited to 'vendor/github.com/google/go-querystring/README.md')
-rw-r--r-- | vendor/github.com/google/go-querystring/README.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/github.com/google/go-querystring/README.md b/vendor/github.com/google/go-querystring/README.md new file mode 100644 index 0000000..0e600be --- /dev/null +++ b/vendor/github.com/google/go-querystring/README.md | |||
@@ -0,0 +1,37 @@ | |||
1 | # go-querystring # | ||
2 | |||
3 | [![GoDoc](https://godoc.org/github.com/google/go-querystring/query?status.svg)](https://godoc.org/github.com/google/go-querystring/query) [![Build Status](https://travis-ci.org/google/go-querystring.svg?branch=master)](https://travis-ci.org/google/go-querystring) | ||
4 | |||
5 | go-querystring is Go library for encoding structs into URL query parameters. | ||
6 | |||
7 | ## Usage ## | ||
8 | |||
9 | ```go | ||
10 | import "github.com/google/go-querystring/query" | ||
11 | ``` | ||
12 | |||
13 | go-querystring is designed to assist in scenarios where you want to construct a | ||
14 | URL using a struct that represents the URL query parameters. You might do this | ||
15 | to enforce the type safety of your parameters, for example, as is done in the | ||
16 | [go-github][] library. | ||
17 | |||
18 | The query package exports a single `Values()` function. A simple example: | ||
19 | |||
20 | ```go | ||
21 | type Options struct { | ||
22 | Query string `url:"q"` | ||
23 | ShowAll bool `url:"all"` | ||
24 | Page int `url:"page"` | ||
25 | } | ||
26 | |||
27 | opt := Options{ "foo", true, 2 } | ||
28 | v, _ := query.Values(opt) | ||
29 | fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" | ||
30 | ``` | ||
31 | |||
32 | [go-github]: https://github.com/google/go-github/commit/994f6f8405f052a117d2d0b500054341048fbb08 | ||
33 | |||
34 | ## License ## | ||
35 | |||
36 | This library is distributed under the BSD-style license found in the [LICENSE](./LICENSE) | ||
37 | file. | ||