Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Default charset to be used with StringWithCharset function DefaultCharset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" SpecialCharset = "!@#$%&*+-_" // Password charset adds special chars PasswordCharset = DefaultCharset + SpecialCharset )
Variables ¶
This section is empty.
Functions ¶
func StringWithCharset ¶
Generates a random string with the charset infromed and the length
func TruncateString ¶
func ValidateEmail ¶
Types ¶
type PasswordValidator ¶
type PasswordValidator struct {
// contains filtered or unexported fields
}
func GetPasswordValidatorInstance ¶
func GetPasswordValidatorInstance() (*PasswordValidator, error)
GetPasswordValidatorInstance (1) retrieves the reference for a global PasswordValidator instance if it already exists or (2) creates a new one, assigns it to the aforementioned global reference, and returns it.
func (*PasswordValidator) ValidatePassword ¶
func (pv *PasswordValidator) ValidatePassword(input string) error
ValidatePassword returns an error if the password does not meet the requirements.
type ValidatePasswordError ¶
ValidatePasswordError is an error type that contains the failed validations specified under a map.
func (*ValidatePasswordError) Error ¶
func (e *ValidatePasswordError) Error() string
func (*ValidatePasswordError) FailedValidations ¶
func (e *ValidatePasswordError) FailedValidations() map[string]string
func (*ValidatePasswordError) Unwrap ¶
func (e *ValidatePasswordError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.