diff options
author | Wim <wim@42.be> | 2019-06-16 23:33:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-16 23:33:25 +0200 |
commit | cb712ff37d3c20a21695e00c52fff213a6fd40b4 (patch) | |
tree | 0ba0ee4f55bf6ace2656562465cc82d807e741b9 /vendor/github.com/gorilla/schema/README.md | |
parent | f4ae61044888f591830e6c1be9a2bdb14f88943e (diff) | |
download | matterbridge-msglm-cb712ff37d3c20a21695e00c52fff213a6fd40b4.tar.gz matterbridge-msglm-cb712ff37d3c20a21695e00c52fff213a6fd40b4.tar.bz2 matterbridge-msglm-cb712ff37d3c20a21695e00c52fff213a6fd40b4.zip |
Update vendor (#852)
Diffstat (limited to 'vendor/github.com/gorilla/schema/README.md')
-rw-r--r-- | vendor/github.com/gorilla/schema/README.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vendor/github.com/gorilla/schema/README.md b/vendor/github.com/gorilla/schema/README.md index 2c3ecd8e..aefdd669 100644 --- a/vendor/github.com/gorilla/schema/README.md +++ b/vendor/github.com/gorilla/schema/README.md @@ -11,7 +11,7 @@ Package gorilla/schema converts structs to and from form values. Here's a quick example: we parse POST form values and then decode them into a struct: ```go -// Set a Decoder instance as a package global, because it caches +// Set a Decoder instance as a package global, because it caches // meta-data about structs, and an instance can be shared safely. var decoder = schema.NewDecoder() @@ -27,9 +27,9 @@ func MyHandler(w http.ResponseWriter, r *http.Request) { } var person Person - + // r.PostForm is a map of our POST form values - err := decoder.Decode(&person, r.PostForm) + err = decoder.Decode(&person, r.PostForm) if err != nil { // Handle error } @@ -64,9 +64,9 @@ To define custom names for fields, use a struct tag "schema". To not populate ce ```go type Person struct { - Name string `schema:"name"` // custom name - Phone string `schema:"phone"` // custom name - Admin bool `schema:"-"` // this field is never set + Name string `schema:"name,required"` // custom name, must be supplied + Phone string `schema:"phone"` // custom name + Admin bool `schema:"-"` // this field is never set } ``` @@ -83,8 +83,8 @@ The supported field types in the struct are: Unsupported types are simply ignored, however custom types can be registered to be converted. -More examples are available on the Gorilla website: http://www.gorillatoolkit.org/pkg/schema +More examples are available on the Gorilla website: https://www.gorillatoolkit.org/pkg/schema -## License +## License BSD licensed. See the LICENSE file for details. |