Documentation ¶
Overview ¶
Package fiber provides utility functions for gofiber v2, jwt-go With additional validation functions, sending JSON response and parsing request bodies, getting JWT claims
Index ¶
- func AuthenticationMiddleware(j JWTConfig) func(*fiber.Ctx) error
- func CheckFieldLength(field, title string, max, min int) (ok bool, message string)
- func GenerateJWTSignedString(claimMaps fiber.Map) (string, error)
- func GetJSONFieldValues(q interface{}) map[string]string
- func GetJWTClaim(key string) map[string]interface{}
- func GetJWTClaimOfType(key string, valueType interface{}) error
- func GetJWTClaims() jwt.MapClaims
- func LogError(err error)
- func ParseBody(in interface{}) error
- func SendBadRequestResponse(message string) error
- func SendJSONMessage(message string, isSuccess bool, httpStatusCode int) error
- func SendSuccessResponse(message string) error
- func ValidateField(field, title string, isMandatory bool, max, min int, format string) (ok bool, message string)
- func ValidateJSONField(q interface{}, tag string, isMandatory bool, max, min int, format string) (bool, string)
- type Context
- type JWTConfig
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticationMiddleware ¶ added in v0.1.1
AuthenticationMiddleware ...
func CheckFieldLength ¶
CheckFieldLength Validation of strings' length and return if valid based on maximum and minimum length specified and error message if invalid
func GenerateJWTSignedString ¶ added in v0.1.1
GenerateJWTSignedString ...
func GetJSONFieldValues ¶
GetJSONFieldValues Returns a map of JSON keys and values of a struct
func GetJWTClaim ¶
GetJWTClaim Wrapper function for getting a JWT claim by key
func GetJWTClaimOfType ¶ added in v0.1.2
GetJWTClaimOfType ...
func GetJWTClaims ¶
func GetJWTClaims() jwt.MapClaims
GetJWTClaims Get User JWT claims of the current context
func ParseBody ¶
func ParseBody(in interface{}) error
ParseBody Parses the request body from the copied current context
func SendBadRequestResponse ¶
SendBadRequestResponse Wrapper function for SendJSONMessage of 400 Bad request
func SendJSONMessage ¶
SendJSONMessage Sends JSON Message with HTTP Status code to current context
func SendSuccessResponse ¶
SendSuccessResponse Wrapper function for SendJSONMessage of 200 Success
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context GoFiber Context
var Ctx Context
Ctx Context to be initiated by the New function