Documentation
¶
Overview ¶
Package correlation normalizes correlation IDs and carries them through explicit contexts. Correlation is diagnostic metadata, never authorization or ownership authority.
Index ¶
Examples ¶
Constants ¶
View Source
const DefaultHeader = "X-Correlation-ID"
DefaultHeader is the correlation header used at HTTP ingress.
Variables ¶
View Source
var ErrInvalidID = errors.New("invalid correlation ID")
ErrInvalidID identifies malformed, missing, or zero correlation input.
Functions ¶
Types ¶
type ID ¶
ID aliases the approved UUID value used by command/query results.
func FromContext ¶
FromContext reads Fundamentals.Go's shared context key, returns zero when absent, and never generates an ID. It panics if ctx is nil.
func Resolve ¶
Resolve prefers valid supplied text, then a nonzero context ID, then generation.
Example ¶
package main
import (
"context"
"fmt"
"github.com/cratis/arc.go/correlation"
)
func main() {
id, err := correlation.Resolve(context.Background(), "12345678-ABCD-4ABC-8DEF-123456789012")
if err != nil {
panic(err)
}
fmt.Println(id)
}
Output: 12345678-abcd-4abc-8def-123456789012
Click to show internal directories.
Click to hide internal directories.