helper

package
v0.0.0-...-a02f58f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortWithBadRequest

func AbortWithBadRequest(ctx *gin.Context, ginBindingError error)

helper for serializing validation errors (and similar) properly everything but validation and json-unmarshall errors are considered unkown

func AbortWithCustomError

func AbortWithCustomError(ctx *gin.Context, err error)

aborts all but the current handler and returns statuscode 500 with a specific error message from the custom error

func AbortWithOk

func AbortWithOk(ctx *gin.Context, err error)

aborts all but the current handler and returns statuscode 200

func AbortWithUnkownError

func AbortWithUnkownError(ctx *gin.Context, err error)

aborts all but the current handler and returns statuscode 500 with "unkown error"-message

func GetTraceId

func GetTraceId(ctx context.Context) string

func TracingMiddleWare

func TracingMiddleWare(c *gin.Context)

Sets a uuid for the context of every gin-request

Types

type TracingHook

type TracingHook struct{}

func (TracingHook) Run

func (h TracingHook) Run(e *zerolog.Event, level zerolog.Level, msg string)

used for zerolog as a hook whenever "Ctx(ctx)" is used in logging

Jump to

Keyboard shortcuts

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