contexti

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KindKey = attribute.Key("context.key")
)

Variables

This section is empty.

Functions

func GetPool

func GetPool[REQ any]() sync.Pool

func SetTracer added in v1.8.0

func SetTracer(t trace.Tracer)

func Tracing added in v1.7.2

func Tracing(ctx context.Context, name string) (context.Context, trace.Span)

Types

type AuthInfo

type AuthInfo interface {
	IdStr() string
}

type Context

type Context struct {
	TraceID string
	Values  map[string]any
	// contains filtered or unexported fields
}

func ContextFromContext added in v1.4.9

func ContextFromContext(ctx context.Context) *Context

func NewContext added in v1.4.9

func NewContext(ctx context.Context) *Context

func (*Context) Context added in v1.8.2

func (c *Context) Context() context.Context

func (*Context) ContextWrapper

func (c *Context) ContextWrapper() context.Context

func (*Context) SetContext added in v1.8.2

func (c *Context) SetContext(ctx context.Context)

func (*Context) StartSpan

func (c *Context) StartSpan(name string, o ...trace.SpanStartOption) (*Context, trace.Span)

type DeviceInfo added in v1.4.9

type DeviceInfo struct {
	//设备
	Device     string `json:"device" gorm:"size:255"`
	Os         string `json:"os" gorm:"size:255"`
	AppCode    string `json:"appCode" gorm:"size:255"`
	AppVersion string `json:"appVersion" gorm:"size:255"`
	IP         string `json:"ip" gorm:"size:255"`
	Lng        string `json:"lng" gorm:"type:numeric(10,6)"`
	Lat        string `json:"lat" gorm:"type:numeric(10,6)"`
	Area       string `json:"area" gorm:"size:255"`
	UserAgent  string `json:"userAgent" gorm:"size:255"`
}

func Device added in v1.4.9

func Device(infoHeader, area, localHeader, userAgent, ip string) *DeviceInfo

type RequestContext added in v1.4.9

type RequestContext[REQ any] struct {
	TraceID string

	Token  string
	AuthID string
	AuthInfo
	AuthInfoRaw string

	*DeviceInfo

	request.RequestAt
	RequestCtx REQ
	grpc.ServerTransportStream

	Internal string
	Values   map[string]any
	// contains filtered or unexported fields
}

func NewRequestContext added in v1.8.2

func NewRequestContext[REQ any](ctx context.Context, traceId string) *RequestContext[REQ]

func RequestContextFromContext added in v1.8.2

func RequestContextFromContext[REQ any](ctx context.Context) *RequestContext[REQ]

func (*RequestContext[REQ]) Context added in v1.8.0

func (c *RequestContext[REQ]) Context() context.Context

func (*RequestContext[REQ]) ContextWrapper added in v1.4.9

func (c *RequestContext[REQ]) ContextWrapper() context.Context

func (*RequestContext[REQ]) Error added in v1.4.9

func (c *RequestContext[REQ]) Error(args ...interface{})

func (*RequestContext[REQ]) ErrorLog added in v1.4.9

func (c *RequestContext[REQ]) ErrorLog(err, originErr error, funcName string) error

func (*RequestContext[REQ]) HandleError added in v1.4.9

func (c *RequestContext[REQ]) HandleError(err error)

func (*RequestContext[REQ]) Method added in v1.4.9

func (c *RequestContext[REQ]) Method() string

func (*RequestContext[REQ]) SetContext added in v1.7.2

func (c *RequestContext[REQ]) SetContext(ctx context.Context)

func (*RequestContext[REQ]) StartSpan added in v1.4.9

func (c *RequestContext[REQ]) StartSpan(name string, o ...trace.SpanStartOption) (*RequestContext[REQ], trace.Span)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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