middleware

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLimitFromRequest

func GetLimitFromRequest(c *gin.Context) int

GetLimitFromRequest : returns the value of the request parameter "limit".

func GetOffsetFromRequest

func GetOffsetFromRequest(c *gin.Context) int

GetOffsetFromRequest : returns the value of the request parameter "offset".

func VerifyLimitAndOffset

func VerifyLimitAndOffset(defaultOffset, defaultLimit, maxLimit int) gin.HandlerFunc

VerifyLimitAndOffset : verify the request parameters "limit" and "offset".

func VerifyLocaleParameter

func VerifyLocaleParameter(cfg Config) gin.HandlerFunc

VerifyLocaleParameter : verify the parameter "locale".

func VerifyURLParameter

func VerifyURLParameter(cfg Config) gin.HandlerFunc

VerifyURLParameter : verify that a URL parameter is present and its format.

Types

type Config

type Config struct {
	Name                         string // The key of the URL parameter to verify.
	SkipVerifyingInvalidObjectID bool
	StoreKey                     string // The key which in the context the value is stored.
	MessageKey                   string // The key of the error message.
	NotFoundReasonKey            string // The key of the reason of the error "not found".
	NotFoundRecoveryKey          string // The key of the recovery of the error "not found".
	InvalidObjectIDReasonKey     string // The key of the reason of the error "invalid object ID".
	InvalidObjectIDRecoveryKey   string // The key of the recovery of the error "invalid object ID".
}

Config : the configuration of a middleware.

Jump to

Keyboard shortcuts

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