carrier

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package carrier provides carrier type matching for context propagation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchResult added in v0.6.1

type MatchResult struct {
	Carrier config.CarrierDef
	VarName string
}

MatchResult represents a successful carrier match. It captures the validated state after matching, eliminating the need for callers to handle multiple return values.

func Match

func Match(param *dst.Field, registry *config.CarrierRegistry) *MatchResult

Match extracts carrier info from a function parameter. It returns a MatchResult if the parameter matches a registered carrier, or nil if no match is found.

The function supports:

  • Direct types with resolved paths (from NewDecoratorFromPackage)
  • Selector expressions (pkg.Type) with path set by decorator
  • Pointer types (*T)

Note: This requires type-resolved DST (via NewDecoratorFromPackage). The dst.Ident.Path field must be set for carrier matching to work.

Jump to

Keyboard shortcuts

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