utils

package
v0.0.0-...-4c1f3c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultPerPage = 10
	DefaultPage    = 1
)

Variables

View Source
var (
	JwtSigningKey = "lol u thought this would be secure"
)

Functions

func ApplyMiddleware

func ApplyMiddleware(e *gin.Engine, logger *zap.Logger) *gin.Engine

func AuthenticateMiddleware

func AuthenticateMiddleware(c *gin.Context)

func ErrorHandler

func ErrorHandler(logger *zap.Logger) gin.HandlerFunc

ErrorHandler responds errors in a user-friendly format and logs them to the console.

func GeneratePaginationData

func GeneratePaginationData(prefix string, total int, pq PaginationQuery) api.PaginationData

func ValidatorFunc

func ValidatorFunc(c *gin.Context, message string, code int)

Types

type PaginationQuery

type PaginationQuery struct {
	PerPage int `form:"perPage" json:"perPage"`
	Page    int `form:"page" json:"page"`
}

func NewPaginationQuery

func NewPaginationQuery() PaginationQuery

func (PaginationQuery) Offset

func (pq PaginationQuery) Offset() int

func (*PaginationQuery) Read

func (pq *PaginationQuery) Read(ctx *gin.Context)

func (*PaginationQuery) ReadFromOptional

func (pq *PaginationQuery) ReadFromOptional(page *int, perPage *int)

type UserClaims

type UserClaims struct {
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL