blogapictx

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StoreToContext

func StoreToContext(ctx context.Context, bctx BlogAPIContext) context.Context

StoreToContext stores the BlogAPIContext in context.Context.

Types

type BlogAPIContext

type BlogAPIContext struct {
	RequestID string
	Incoming  Request
	Outgoing  *Request
}

func FromContext

func FromContext(ctx context.Context) *BlogAPIContext

FromContext returns the BlogAPIContext stored in context.Context.

func New

func New(
	requestID string,
	path string,
	requestType RequestType,
	requestHeader map[string][]string,
	requestBody interface{},
) BlogAPIContext

New returns a new BlogAPIContext.

type Request

type Request struct {
	Type      RequestType
	Service   string // micro services service name
	Path      string // gRPC method, REST path, GraphQL path
	Headers   map[string][]string
	StartTime time.Time
	Duration  *string
	Status    *string
	Body      interface{}
}

type RequestType

type RequestType string
const (
	RequestTypeGRPC    RequestType = "grpc"
	RequestTypeRest    RequestType = "http"
	RequestTypeGraphQL RequestType = "graphql"
)

Jump to

Keyboard shortcuts

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