metadata

package
v0.0.1-0...-6deec57 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithMetadata

func ContextWithMetadata(ctx context.Context, m *Metadata) context.Context

ContextWithMetadata returns a new Context that carries metadata ptr.

Types

type Metadata

type Metadata struct {
	Now        time.Time `json:"-"`
	TraceID    string    `json:"trace_id,omitempty"`
	IPAddress  net.IP    `json:"ip_address,omitempty"`
	StatusCode int       `json:"http_status,omitempty"`
	UserAgent  string    `json:"http_user_agent,omitempty"`
	RemoteAddr string    `json:"http_remote_addr,omitempty"`
	Referer    string    `json:"http_referer,omitempty"`
	Err        error     `json:"-"`
}

Metadata represent state for each request.

func FromContext

func FromContext(ctx context.Context) (*Metadata, bool)

FromContext returns the Identity value stored in ctx, if any.

func New

func New() *Metadata

Jump to

Keyboard shortcuts

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