weapp/pkg/form/form.go

30 lines
453 B
Go

package form
import "net/url"
func SafeQuery(values url.Values, v interface{}) error {
if err := Decode(values, v); err != nil {
return err
}
if err := ConformStruct(v); err != nil {
return err
}
if err := ValidateStruct(v); err != nil {
return err
}
return nil
}
func SafeStruct(v interface{}) error {
if err := ConformStruct(v); err != nil {
return err
}
if err := ValidateStruct(v); err != nil {
return err
}
return nil
}