util

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeValue added in v0.14.0

func EscapeValue(value string) string

EscapeValue safely escapes any string by removing any new lines and HTML escaping it.

func FormParameter added in v0.14.0

func FormParameter(c *gin.Context, parameter string) string

FormParameter safely captures a form parameter from the context by removing any new lines and HTML escaping the value.

func HandleError

func HandleError(c *gin.Context, status int, err error)

HandleError appends the error to the handler chain for logging and outputs it.

func MaxInt

func MaxInt(a, b int) int

MaxInt is a helper function to clamp the integer which prevents it from being higher then the provided value.

Currently, Go only supports float64 via math. ( max | min ).

func MinInt

func MinInt(a, b int) int

MinInt is a helper function to clamp the integer which prevents it from being lower then the provided value.

Currently, Go only supports float64 via math. ( max | min ).

func PathParameter added in v0.14.0

func PathParameter(c *gin.Context, parameter string) string

PathParameter safely captures a path parameter from the context by removing any new lines and HTML escaping the value.

func QueryParameter added in v0.14.0

func QueryParameter(c *gin.Context, parameter, value string) string

QueryParameter safely captures a query parameter from the context by removing any new lines and HTML escaping the value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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