ctxmissing

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package ctxmissing provides the context missing strategy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IgnoreStrategy added in v1.7.0

type IgnoreStrategy struct{}

IgnoreStrategy is a Strategy that do nothing when the segment context is missing.

func NewIgnoreStrategy added in v1.7.0

func NewIgnoreStrategy() *IgnoreStrategy

NewIgnoreStrategy returns a new IgnoreStrategy.

func (*IgnoreStrategy) ContextMissing added in v1.7.0

func (*IgnoreStrategy) ContextMissing(ctx context.Context, v any)

ContextMissing implements Strategy.

type LogErrorStrategy

type LogErrorStrategy struct{}

LogErrorStrategy is a Strategy that logs the error when the segment context is missing.

func NewLogErrorStrategy added in v1.7.0

func NewLogErrorStrategy() *LogErrorStrategy

NewLogErrorStrategy returns a new LogErrorStrategy.

func (*LogErrorStrategy) ContextMissing

func (*LogErrorStrategy) ContextMissing(ctx context.Context, v any)

ContextMissing implements Strategy.

type RuntimeErrorStrategy

type RuntimeErrorStrategy struct{}

RuntimeErrorStrategy is a Strategy that panics when the segment context is missing.

func NewRuntimeErrorStrategy added in v1.7.0

func NewRuntimeErrorStrategy() *RuntimeErrorStrategy

NewRuntimeErrorStrategy returns a new RuntimeErrorStrategy.

func (*RuntimeErrorStrategy) ContextMissing

func (*RuntimeErrorStrategy) ContextMissing(ctx context.Context, v any)

ContextMissing implements Strategy.

type Strategy

type Strategy interface {
	// ContextMissing is called when any segment is not associated with a context.
	ContextMissing(ctx context.Context, v any)
}

Strategy provides an interface for implementing context missing strategies.

type StrategyFunc added in v1.7.0

type StrategyFunc func(ctx context.Context, v any)

StrategyFunc is an adapter to allow the use of ordinary functions as context missing strategies.

func (StrategyFunc) ContextMissing added in v1.7.0

func (s StrategyFunc) ContextMissing(ctx context.Context, v any)

Jump to

Keyboard shortcuts

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