Last active
September 24, 2019 16:28
-
-
Save phuctm97/707858a34e6891649642d68ec9311428 to your computer and use it in GitHub Desktop.
Go RESTful Series
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package users | |
import ( | |
"errors" | |
"regexp" | |
"github.com/the-evengers/go-restful/common" | |
) | |
// ... other stuff ... | |
// ValidateUser validates a user data and returns validation errors or nil. | |
func ValidateUser(user *User) error { | |
errs := make([]error, 0) | |
// ... validations ... | |
// Return errors or nil. | |
if len(errs) == 0 { | |
return nil | |
} | |
return common.Errors(errs) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment