Documentation
¶
Index ¶
- func GetPool[REQ, RES any]() sync.Pool
- type AuthInfo
- type Context
- type DeviceInfo
- type RequestContext
- func (c *RequestContext[REQ, RES]) ContextWrapper() context.Context
- func (c *RequestContext[REQ, RES]) Error(args ...interface{})
- func (c *RequestContext[REQ, RES]) ErrorLog(err, originErr error, funcName string) error
- func (c *RequestContext[REQ, RES]) HandleError(err error)
- func (c *RequestContext[REQ, W]) Method() string
- func (c *RequestContext[REQ, RES]) StartSpan(name string, o ...trace.StartOption) (*RequestContext[REQ, RES], *trace.Span)
- func (c *RequestContext[REQ, W]) WithContext(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context = RequestContext[empty, empty]
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, RES any] struct { context.Context TraceID string Token string AuthID string AuthInfo AuthInfoRaw string *DeviceInfo request.RequestAt Request REQ Response RES grpc.ServerTransportStream Internal string Values map[string]any }
func ContextFromContext ¶ added in v1.4.9
func ContextFromContext[REQ, RES any](ctx context.Context) *RequestContext[REQ, RES]
func NewContext ¶ added in v1.4.9
func NewContext[REQ, RES any](ctx context.Context) *RequestContext[REQ, RES]
func (*RequestContext[REQ, RES]) ContextWrapper ¶ added in v1.4.9
func (c *RequestContext[REQ, RES]) ContextWrapper() context.Context
func (*RequestContext[REQ, RES]) Error ¶ added in v1.4.9
func (c *RequestContext[REQ, RES]) Error(args ...interface{})
func (*RequestContext[REQ, RES]) ErrorLog ¶ added in v1.4.9
func (c *RequestContext[REQ, RES]) ErrorLog(err, originErr error, funcName string) error
func (*RequestContext[REQ, RES]) HandleError ¶ added in v1.4.9
func (c *RequestContext[REQ, RES]) HandleError(err error)
func (*RequestContext[REQ, W]) Method ¶ added in v1.4.9
func (c *RequestContext[REQ, W]) Method() string
func (*RequestContext[REQ, RES]) StartSpan ¶ added in v1.4.9
func (c *RequestContext[REQ, RES]) StartSpan(name string, o ...trace.StartOption) (*RequestContext[REQ, RES], *trace.Span)
func (*RequestContext[REQ, W]) WithContext ¶ added in v1.4.9
func (c *RequestContext[REQ, W]) WithContext(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.