Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
GenerateToken generates the token by given claims and HS256
func GetJWTSecret ¶
func GetJWTSecret() []byte
func GetPageOffset ¶
GetPageOffset gets the offset according page and pageSize
func GetPageSize ¶
GetPageSize gets the page size according page_size field in the DB
Types ¶
type Claims ¶
type Claims struct { jwt.RegisteredClaims AppKey string `json:"app_key"` AppSecret string `json:"app_secret"` }
func ParseToken ¶
ParseToken parses given token into a tokenClaims and validates that token according Claims
type Response ¶
Response wraps gin.Context in order to offer response processing
func NewResponse ¶
NewResponse returns a Response instance with given context
func (*Response) ToErrorResponse ¶
ToErrorResponse converts given details into a response body with error message
func (*Response) ToResponse ¶
ToResponse converts any valid data into a response body
func (*Response) ToResponseList ¶
ToResponseList converts a data list into a response list
type ValidError ¶
func (*ValidError) Error ¶
func (v *ValidError) Error() string
type ValidErrors ¶
type ValidErrors []*ValidError
func BindAndValid ¶
func BindAndValid(c *gin.Context, v any) (bool, ValidErrors)
func BindAndValidHeader ¶
func BindAndValidHeader(c *gin.Context, v any) (bool, ValidErrors)
func (*ValidErrors) Error ¶
func (v *ValidErrors) Error() string
func (ValidErrors) Errors ¶
func (v ValidErrors) Errors() []string
Click to show internal directories.
Click to hide internal directories.