Documentation ¶
Index ¶
- Constants
- func GetClaimFromJWT(r *http.Request, ClaimID string) (interface{}, error)
- func GetClaimStringFromJWT(r *http.Request, claimID string) (string, error)
- func Hash(plainString string) (string, error)
- func HashCompare(plainString string, hashedString string) bool
- func IsZeroOfUnderlyingType(x interface{}) bool
- func MergeError(message string, err ...error) error
- func ParsePayload(r *http.Request, result interface{}) error
- func RandString(n int) string
- func URLParam(r *http.Request, key string) string
- func WriteJSONData(w http.ResponseWriter, data interface{}, message ...string)
- func WriteJSONDataWithTotal(w http.ResponseWriter, data interface{}, total int64, message ...string)
- func WriteJSONError(w http.ResponseWriter, err error, statusCode ...int)
- type Error
Constants ¶
View Source
const (
//ErrUtilJWTMapping error message for JWT mapping
ErrUtilJWTMapping = "invalid mapping JWT claim with key '%s'"
)
Variables ¶
This section is empty.
Functions ¶
func GetClaimFromJWT ¶
GetClaimFromJWT get claim value using id
func GetClaimStringFromJWT ¶
GetClaimStringFromJWT get ID From claim
func HashCompare ¶
HashCompare compare hashed string with plain string
func IsZeroOfUnderlyingType ¶
func IsZeroOfUnderlyingType(x interface{}) bool
func MergeError ¶
MergeError merge error message
func ParsePayload ¶
ParsePayload parse http body to respected model payload := new(model.User) _ := util.ParsePayload(r, payload)
func RandString ¶
func WriteJSONData ¶
func WriteJSONData(w http.ResponseWriter, data interface{}, message ...string)
WriteJSONData write http response as json
func WriteJSONDataWithTotal ¶
func WriteJSONDataWithTotal(w http.ResponseWriter, data interface{}, total int64, message ...string)
WriteJSONDataWithTotal write http response as json with total data. Usualy it is used for grid / table data
func WriteJSONError ¶
func WriteJSONError(w http.ResponseWriter, err error, statusCode ...int)
WriteJSONError write http response error as json
Types ¶
Click to show internal directories.
Click to hide internal directories.