Chain() — fiber Function Reference
Architecture documentation for the Chain() function in extractors.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 1f00988f_0868_50d8_cb7f_d3beb6689f79["Chain()"] 9369d97d_10d6_c835_81b9_8542715b2822["extractors.go"] 1f00988f_0868_50d8_cb7f_d3beb6689f79 -->|defined in| 9369d97d_10d6_c835_81b9_8542715b2822 style 1f00988f_0868_50d8_cb7f_d3beb6689f79 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
extractors/extractors.go lines 462–503
func Chain(extractors ...Extractor) Extractor {
if len(extractors) == 0 {
return Extractor{
Extract: func(fiber.Ctx) (string, error) {
return "", ErrNotFound
},
Source: SourceCustom,
Key: "",
Chain: []Extractor{},
}
}
// Use the source and key from the first extractor as the primary
primarySource := extractors[0].Source
primaryKey := extractors[0].Key
return Extractor{
Extract: func(c fiber.Ctx) (string, error) {
var lastErr error // last error encountered (including ErrNotFound)
for _, extractor := range extractors {
if extractor.Extract == nil {
continue
}
v, err := extractor.Extract(c)
if err == nil && v != "" {
return v, nil
}
if err != nil {
lastErr = err
}
}
if lastErr != nil {
return "", lastErr
}
return "", ErrNotFound
},
Source: primarySource,
Key: primaryKey,
Chain: append([]Extractor(nil), extractors...), // Defensive copy for introspection
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Chain() do?
Chain() is a function in the fiber codebase, defined in extractors/extractors.go.
Where is Chain() defined?
Chain() is defined in extractors/extractors.go at line 462.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free