Documentation ¶
Index ¶
- Variables
- func CheckIsAdminReq(c *fiber.Ctx) bool
- func GetTokenByReq(c *fiber.Ctx) string
- func GetUserByReq(c *fiber.Ctx) (*model.User, error)
- func InitCommentFilter()
- func InitEmoji()
- func LoginGetUserToken(user model.User, key string, ttl int) (string, error)
- func ParamsDecode(c *fiber.Ctx, destParams interface{}) (isContinue bool, resp error)
- func SendError(c *fiber.Ctx, code int, message string) error
- func SendResponse(c *fiber.Ctx, code int, message string, data interface{}) error
- func SendSuccess(c *fiber.Ctx, data interface{}) error
- func ValidateEmail(email string) bool
- func ValidateRequired(c *fiber.Ctx, destParams interface{}) (isContinue bool, resp error)
- func ValidateURL(url string) bool
- type JwtCustomClaims
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var CommentFilter *sensitive.Filter
View Source
var EmojiJson []dto.EmojiJson
View Source
var ErrTokenNotProvided = fmt.Errorf("token not provided")
View Source
var ErrTokenUserNotFound = fmt.Errorf("user not found")
Functions ¶
func CheckIsAdminReq ¶
func CheckIsAdminReq(c *fiber.Ctx) bool
func GetTokenByReq ¶
func GetTokenByReq(c *fiber.Ctx) string
func GetUserByReq ¶
func InitCommentFilter ¶
func InitCommentFilter()
func LoginGetUserToken ¶
func ParamsDecode ¶
func SendResponse ¶
SendResponse sends a JSON response to the client
func SendSuccess ¶
func SendSuccess(c *fiber.Ctx, data interface{}) error
SendSuccess sends a successful JSON response with a default code of 200
func ValidateEmail ¶
func ValidateRequired ¶
func ValidateURL ¶
Types ¶
type JwtCustomClaims ¶
type JwtCustomClaims struct { UserID uint `json:"user_id"` jwt.StandardClaims }
JwtCustomClaims are custom claims extending default ones. See https://github.com/golang-jwt/jwt for more examples
func GetJwtDataByReq ¶
func GetJwtDataByReq(c *fiber.Ctx) (JwtCustomClaims, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.