File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,38 @@ The `forms` package can be added to a project by running:
1414go get cattlecloud.net/go/forms@latest
1515```
1616
17+ ``` go
18+ import " cattlecloud.net/go/forms"
19+ ```
20+
21+ ### Examples
22+
23+ ##### parsing http request
24+
25+ ``` go
26+ var (
27+ name string
28+ age int
29+ )
30+
31+ err := forms.Parse (request, forms.Schema {
32+ " NAME" : forms.String (&name),
33+ " AGE" : forms.Int (&age),
34+ })
35+ ```
36+
37+ ##### about requests
38+
39+ Typically the HTTP request will be given to you in the form of an http handler,
40+ e.g.
41+
42+ ``` go
43+ func (w http .ResponseWriter , r *http .Request ) {
44+ _ = r.ParseForm ()
45+ // now r form data is available to parse
46+ }
47+ ```
48+
1749### License
1850
1951The ` cattlecloud.net/go/forms ` module is open source under the [ BSD] ( LICENSE ) license.
Original file line number Diff line number Diff line change 11// Copyright (c) CattleCloud LLC
22// SPDX-License-Identifier: BSD-3-Clause
33
4- // Package formdata provides a way to safely and conveniently extract html Form
4+ // Package forms provides a way to safely and conveniently extract html Form
55// data using a definied schema.
6- package formdata
6+ package forms
77
88import (
99 "errors"
Original file line number Diff line number Diff line change 11// Copyright (c) CattleCloud LLC
22// SPDX-License-Identifier: BSD-3-Clause
33
4- package formdata
4+ package forms
55
66import (
77 "context"
Original file line number Diff line number Diff line change 11module cattlecloud.net/go/forms
22
3- go 1.23.4
3+ go 1.23
44
55require (
66 github.com/shoenig/go-conceal v0.5.4
You can’t perform that action at this time.
0 commit comments