ginutils

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx context.Context, c *gin.Context) context.Context

Context returns a new Go context from a Gin context.

func GetRequiredHeader

func GetRequiredHeader(ctx *gin.Context, headerName string) (string, bool)

GetRequiredHeader returns a header value or responds with an error.

func ParamsToMap

func ParamsToMap(params gin.Params) map[string]string

ParamsToMap converts a Gin parameter list to a simple string map.

func ReplyWithErrorResponse

func ReplyWithErrorResponse(ctx *gin.Context, errorResponse *common.ErrorResponse)

ReplyWithErrorResponse replies with an error response.

func RequiredHeaderMissingErrorResponse

func RequiredHeaderMissingErrorResponse(headerName string) *common.ErrorResponse

RequiredHeaderMissingErrorResponse creates a common.ErrorResponse denoting missing required header.

func RequiredQueryMissingErrorResponse

func RequiredQueryMissingErrorResponse(queryName string) *common.ErrorResponse

RequiredQueryMissingErrorResponse creates a common.ErrorResponse denoting missing required header.

func RequiredQueryOrAbort

func RequiredQueryOrAbort(ctx *gin.Context, queryName string) (string, bool)

RequiredQueryOrAbort returns a query value or responds with an error.

func UintParam

func UintParam(ctx *gin.Context, paramName string) (uint, bool)

UintParam returns a parameter parsed as uint or responds with an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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