reqctx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 12 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 New added in v0.0.26

func New[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"`
	AppVer    string  `json:"appVer" gorm:"size:255"`
	IP        string  `json:"ip" gorm:"size:255"`
	Lng       float64 `json:"lng" gorm:"type:numeric(10,6)"`
	Lat       float64 `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, location, userAgent, ip string) *DeviceInfo

info: device,os,appCode,appVersion area:xxx location:1.23456,2.123456

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