Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,38 @@ The `forms` package can be added to a project by running:
go get cattlecloud.net/go/forms@latest
```

```go
import "cattlecloud.net/go/forms"
```

### Examples

##### parsing http request

```go
var (
name string
age int
)

err := forms.Parse(request, forms.Schema{
"NAME": forms.String(&name),
"AGE": forms.Int(&age),
})
```

##### about requests

Typically the HTTP request will be given to you in the form of an http handler,
e.g.

```go
func(w http.ResponseWriter, r *http.Request) {
_ = r.ParseForm()
// now r form data is available to parse
}
```

### License

The `cattlecloud.net/go/forms` module is open source under the [BSD](LICENSE) license.
4 changes: 2 additions & 2 deletions forms.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) CattleCloud LLC
// SPDX-License-Identifier: BSD-3-Clause

// Package formdata provides a way to safely and conveniently extract html Form
// Package forms provides a way to safely and conveniently extract html Form
// data using a definied schema.
package formdata
package forms

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion forms_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) CattleCloud LLC
// SPDX-License-Identifier: BSD-3-Clause

package formdata
package forms

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module cattlecloud.net/go/forms

go 1.23.4
go 1.23

require (
github.com/shoenig/go-conceal v0.5.4
Expand Down