correlation_id

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderName = "Correlation-Id"

Variables

View Source
var DefaultIdGenerator = NewRandomIdGenerator(
	rand.New(
		NewLockedSource(
			rand.NewSource(
				time.Now().UTC().UnixNano(),
			),
		),
	),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	HeaderName  string
	IdGenerator func(*http.Request) string
}

func NewConfig

func NewConfig() *Config

type LockedSource

type LockedSource struct {
	// contains filtered or unexported fields
}

LockedSource is a copy of private go lockedSource https://github.com/golang/go/blob/master/src/math/rand/rand.go#L374

func NewLockedSource

func NewLockedSource(src rand.Source) *LockedSource

func (*LockedSource) Int63

func (r *LockedSource) Int63() (n int64)

func (*LockedSource) Seed

func (r *LockedSource) Seed(seed int64)

func (*LockedSource) Uint64

func (r *LockedSource) Uint64() (n uint64)

type RandomIdGenerator

type RandomIdGenerator struct {
	// contains filtered or unexported fields
}

func NewRandomIdGenerator

func NewRandomIdGenerator(rand *rand.Rand) *RandomIdGenerator

func (*RandomIdGenerator) Generate

func (rg *RandomIdGenerator) Generate(length int) string

Jump to

Keyboard shortcuts

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