Documentation ¶
Overview ¶
Package helper for handling response to client
Index ¶
- func APIErrorResponse(c *gin.Context, statusCode int, err interface{})
- func APIResponse(c *gin.Context, statusCode int, message string, data interface{})
- func CheckPasswordHash(password, hash string) bool
- func EmailIsValid(email string) bool
- func GenerateSecureKey(length int) (string, error)
- func HashPassword(password string) (string, error)
- func PasswordTooShort(password string) bool
- type ErrorResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIErrorResponse ¶
APIErrorResponse will send JSON response with error value to the client
func APIResponse ¶
APIResponse will send JSON response to the client and some additional detail
func CheckPasswordHash ¶
CheckPasswordHash will compare 'hashed' password with the 'input' password
func EmailIsValid ¶
EmailIsValid will check whether given email was valid
func GenerateSecureKey ¶
GenerateSecureKey will create 'Secure Key' with given length
func HashPassword ¶
HashPassword will generated hashed password so it wont easily be roken by unauthorized person
func PasswordTooShort ¶
PasswordTooShort will check whether password length is not match the minimum password lenght for the user account
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Status int `json:"status"` Method string `json:"method"` Error interface{} `json:"error"` }
ErrorResponse is a response that containing error Details of the error shoul not be technical as it will be sent to the user