decorators

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLogEventLogFunc

func DefaultLogEventLogFunc[T, R any](ctx context.Context, evt T, res R, err error)

func LogEvent

func LogEvent[T, R any]() engine.Decorator[T, R]

func LogEventWithConfig

func LogEventWithConfig[T, R any](config LogEventConfig[T, R]) engine.Decorator[T, R]

func PanicRecover

func PanicRecover[T, R any]() engine.Decorator[T, R]

PanicRecover is a decorator that recovers from panic and returns an error.

func PanicRecoverWithConfig

func PanicRecoverWithConfig[T, R any](config PanicRecoverConfig[T]) engine.Decorator[T, R]

PanicRecoverWithConfig is a decorator that recovers from panic and returns an error with a custom configuration.

Types

type LogEventConfig

type LogEventConfig[T, R any] struct {
	LogFunc func(context.Context, T, R, error)
}

func DefaultLogEventConfig

func DefaultLogEventConfig[T, R any]() LogEventConfig[T, R]

type PanicRecoverConfig

type PanicRecoverConfig[T any] struct {
	LogFunc func(context.Context, T, error)
}

PanicRecoverConfig is the configuration for the PanicRecover decorator.

func DefaultPanicRecoverConfig

func DefaultPanicRecoverConfig[T any]() PanicRecoverConfig[T]

DefaultPanicRecoverConfig returns the default configuration for the PanicRecover decorator.

Jump to

Keyboard shortcuts

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