Skip to content

v2.0.0

Compare
Choose a tag to compare
@guiferpa guiferpa released this 14 Apr 18:28
· 15 commits to master since this release

Validator struct

  • Validate more clean for source code
validator := gody.NewValidator()

if validated, err := validator.Validate(/*struct*/); err != nil {
    ...
}
  • On demand rules
...

if err := validator.AddRules(/*...rules*/); err != nil {
    ...
}

...
  • Support for set a custom tag name
...

if err := validator.SetTagName(/*name*/); err != nil {
    ...
}

...

Raw functions support

  • RawSerialize receive tag name and the struct to validate.
func RawSerialize(tn string, b interface{}) ([]Field, error)
  • RawValidate receive the struct to validate, tag name and custom rules.
func RawValidate(b interface{}, tn string, rules []Rule) (bool, error)
  • RawDefaultValidate receive the struct to validate, tag name and custom rules.
func RawDefaultValidate(b interface{}, tn string, rules []Rule) (bool, error)

📓 DefaultValidate and RawDefaultValidate it's same, both uses as default rules built-in gody.

Remove the necessity for tag in struct and slice validation

issue #9