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.
Click to show internal directories.
Click to hide internal directories.