continuous-integration/drone/push Build is passing
Details
|
3 years ago | |
---|---|---|
.drone.yml | 4 years ago | |
LICENSE | 8 years ago | |
README.md | 4 years ago | |
bind_test.go | 8 years ago | |
binding.go | 4 years ago | |
circle.yml | 6 years ago | |
common_test.go | 4 years ago | |
errorhandler_test.go | 8 years ago | |
errors.go | 8 years ago | |
errors_test.go | 8 years ago | |
file_test.go | 4 years ago | |
form.go | 8 years ago | |
form_test.go | 4 years ago | |
go.mod | 3 years ago | |
go.sum | 3 years ago | |
json.go | 8 years ago | |
json_test.go | 4 years ago | |
misc_test.go | 4 years ago | |
multipart_test.go | 4 years ago | |
validate.go | 3 years ago | |
validate_test.go | 4 years ago |
README.md
binding

Middlware binding provides request data binding and validation for Tango.
Installation
go get gitea.com/tango/binding
Example
import (
"gitea.com/lunny/tango"
"gitea.com/tango/binding"
)
type Action struct {
binding.Binder
}
type MyStruct struct {
Id int64
Name string
}
func (a *Action) Get() string {
var mystruct MyStruct
errs := a.Bind(&mystruct)
return fmt.Sprintf("%v, %v", mystruct, errs)
}
func main() {
t := tango.Classic()
t.Use(binding.Bind())
t.Get("/", new(Action))
t.Run()
}
Visit /?id=1&name=2
on your browser and you will find output
{1 sss}, []
Getting Help
Credits
This package is forked from macaron-contrib/binding with modifications.
License
This project is under Apache v2 License. See the LICENSE file for the full license text.