func (u *User) Validate() error {
	// hash password if available
	err := u.HashPassword()
	if err != nil {
		return err
	}

	// check id
	if !u.ID().Valid() {
		return fire.E("invalid id")
	}

	// check name
	if u.Name == "" {
		return fire.E("name not set")
	}

	// check email
	if u.Email == "" || !govalidator.IsEmail(u.Email) {
		return fire.E("invalid email")
	}

	// check password hash
	if len(u.PasswordHash) == 0 {
		return fire.E("password hash not set")
	}

	return nil
}
func (u *User) Validate() error {
	
	err := u.HashPassword()
	if err != nil {
		return err
	}

	
	if !u.ID().Valid() {
		return fire.E("invalid id")
	}

	
	if u.Name == "" {
		return fire.E("name not set")
	}

	
	if u.Email == "" || !govalidator.IsEmail(u.Email) {
		return fire.E("invalid email")
	}

	
	if len(u.PasswordHash) == 0 {
		return fire.E("password hash not set")
	}

	return nil
}
func ( u * User ) Validate ( ) error { // hash password if available err := u . HashPassword ( ) if err != nil { return err } // check id if ! u . ID ( ) . Valid ( ) { return fire . E ( " " ) } // check name if u . Name == " " { return fire . E ( " " ) } // check email if u . Email == " " || ! govalidator . IsEmail ( u . Email ) { return fire . E ( " " ) } // check password hash if len ( u . PasswordHash ) == 0 { return fire . E ( " " ) } return nil }
// Validate implements the coal.ValidatableModel interface.
Validate implements the coal . ValidatableModel interface .