requestutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndTimeFrom

func EndTimeFrom(ctx context.Context) (int64, bool)

EndTimeFrom returns the value of the excution info key on the ctx

func WithEndTime

func WithEndTime(parent context.Context, endTime int64) context.Context

WithEndTime returns a copy of parent in which the end time value is set

func WithRequestInfo

func WithRequestInfo(parent context.Context, requestInfo RequestInfo) context.Context

WithRequestInfo returns a copy of parent in which the request info value is set

Types

type RequestInfo

type RequestInfo struct {
	ServiceLabel   string
	Method         string
	Component      string
	IP             string
	URLParam       string
	BodyParam      string
	StartTimeStamp int64
}

RequestInfo holds service information from http.Request

func GetRequestInfo

func GetRequestInfo(r *http.Request) RequestInfo

GetRequestInfo returns request info needed from http.Request

func RequestInfoFrom

func RequestInfoFrom(ctx context.Context) (RequestInfo, bool)

RequestInfoFrom returns the value of the request info key on the ctx

func (*RequestInfo) String

func (info *RequestInfo) String() string

Jump to

Keyboard shortcuts

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