Documentation ¶
Index ¶
- func ContainsAlphabeticCharacters(s string) bool
- func ContainsNoneAlphabeticCharacters(s string) bool
- func ContainsNumbericCharacters(s string) bool
- func ContainsWhitespace(s string) bool
- func DoesPasswordMatch(password, hashedPassword string) bool
- func HashPassword(plainText string) (*string, error)
- func IsAlphaNumeric(s string) bool
- func IsEmail(email string) bool
- func ReadJson(w http.ResponseWriter, r *http.Request, dest interface{}) error
- func StringLengthInBounds(s string, min, max int) bool
- func WriteErrorJsonResponse(w http.ResponseWriter, errorCode string, statusCode int, messages interface{})
- func WriteInternalErrorJsonResponse(w http.ResponseWriter)
- func WriteRequestPayloadError(err error, w http.ResponseWriter)
- func WriteSuccessJsonResponse(w http.ResponseWriter, statusCode int, data interface{})
- type ServerResponse
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAlphabeticCharacters ¶
ContainsAlphabeticCharacters returns true if the provided string 's' alphabetic numbers.
func ContainsNoneAlphabeticCharacters ¶
ContainsNoneAlphabeticCharacters returns true if the provided string 's' contains anything other than alphabetic characters.
func ContainsNumbericCharacters ¶
ContainsNumbericCharacters returns true if the provided string 's' contains numbers.
func ContainsWhitespace ¶
ContainsWhitespace returns true if the provided string 's' contains any whitespace characters.
func DoesPasswordMatch ¶
compares a hashed password with its plaintext version using bcrypt algorithm.
func HashPassword ¶
hashes plaintext password using bcrypt algorithm
func IsAlphaNumeric ¶
IsAlphaNumeric returns true if the provided string 's' contains both alphabetic and numberal characters.
func IsEmail ¶
IsEmail returns true if the provided 'email' contains only the address part of a valid RFC 5322 address.
func ReadJson ¶
func ReadJson(w http.ResponseWriter, r *http.Request, dest interface{}) error
reads json body into 'dest' make sure the `dest` is never nil otherwise it will panic
func StringLengthInBounds ¶
StringLengthInBounds returns true of the provided string 's' is greater than or equal to min and less than or equal to max.
func WriteErrorJsonResponse ¶
func WriteErrorJsonResponse(w http.ResponseWriter, errorCode string, statusCode int, messages interface{})
func WriteInternalErrorJsonResponse ¶
func WriteInternalErrorJsonResponse(w http.ResponseWriter)
func WriteRequestPayloadError ¶
func WriteRequestPayloadError(err error, w http.ResponseWriter)
handles common json parsing errors and writes error response
func WriteSuccessJsonResponse ¶
func WriteSuccessJsonResponse(w http.ResponseWriter, statusCode int, data interface{})
Types ¶
type ServerResponse ¶
type Validatable ¶
type Validatable interface {
Validate() []string
}