code: func (res *Resource) AddValidator(validator *Validator) {
  	for idx, v := range res.Validators {
  		if v.Name == validator.Name {
  			res.Validators[idx] = validator
  			return
  		}
  	}
  
  	res.Validators = append(res.Validators, validator)
  }
docs: // AddValidator add validator to resource, it will invoked when creating, updating, and will rollback the change if validator return any error