weapp/internal/pkg/form/encoding.go
2021-12-28 01:49:22 +08:00

29 lines
436 B
Go

package form
import (
"net/url"
"github.com/go-playground/form/v4"
)
var (
decoder = NewDecoder()
encoder = NewEncoder()
)
func NewDecoder() *form.Decoder {
return form.NewDecoder()
}
func Decode(values url.Values, v interface{}) error {
return decoder.Decode(v, values)
}
func NewEncoder() *form.Encoder {
return form.NewEncoder()
}
func Encode(v interface{}) (values url.Values, err error) {
return encoder.Encode(v)
}