reqctx

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPool

func GetPool[REQ any]() sync.Pool

Types

type AuthInfo

type AuthInfo interface {
	IdStr() string
}

type Context

type Context[REQ any] struct {
	context2.Context
	ReqValue[REQ]
}

func FromContextValue

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

func NewRequestContext

func NewRequestContext[REQ any](ctx context.Context, req REQ) *Context[REQ]

func (*Context[REQ]) Method

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

func (*Context[REQ]) StartSpanX

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

func (*Context[REQ]) Wrapper

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

type DeviceInfo

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

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

type ReqCtx

type ReqCtx[REQ any] context2.ValueContext[ReqValue[REQ]]

type ReqValue

type ReqValue[REQ any] struct {
	Token       string
	AuthInfoRaw string
	AuthID      string
	AuthInfo
	*DeviceInfo
	RequestCtx REQ
	grpc.ServerTransportStream
	Internal string
	http.RequestAt
}

Jump to

Keyboard shortcuts

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