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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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