util

package
v0.22.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAllowlist added in v0.20.0

func CheckAllowlist(r *library.Repo, allowlist []string) bool

CheckAllowlist is a helper function to ensure only repos in the allowlist are specified.

a single entry of '*' allows any repo to be enabled.

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.

func SplitFullName added in v0.20.0

func SplitFullName(value string) (string, string)

SplitFullName safely splits the repo.FullName field into an org and name.

func Unique added in v0.20.0

func Unique(stringSlice []string) []string

Unique is a helper function that takes a slice and validates that there are no duplicate entries.

Types

This section is empty.

Jump to

Keyboard shortcuts

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