thedevsaddam / govalidator

Validate Golang request data with simple rules. Highly inspired by Laravel's request validation.
MIT License
1.32k stars 122 forks source link

How to validate slice of struct ? #118

Open mdsohelmia opened 2 years ago

mdsohelmia commented 2 years ago
  type User struct {
      FirstName string
      LastName string
      Address AddressSliceWrapper
  }

  type Address struct {
      IsMailing bool 
  }

  type Addresses []Address

// AddressSliceWrapper embeds the alias type for the sake of embedding a slice. // This is very heavy-handed.

type AddressSliceWrapper struct {
    Addresses
}