Documentation ¶
Index ¶
- Constants
- func GetPool[REQ any]() sync.Pool
- func SetTracer(t trace.Tracer)
- func Tracing(ctx context.Context, name string) (context.Context, trace.Span)
- type AuthInfo
- type Context
- type DeviceInfo
- type RequestContext
- func (c *RequestContext[REQ]) Context() context.Context
- func (c *RequestContext[REQ]) ContextWrapper() context.Context
- func (c *RequestContext[REQ]) Error(args ...interface{})
- func (c *RequestContext[REQ]) ErrorLog(err, originErr error, funcName string) error
- func (c *RequestContext[REQ]) HandleError(err error)
- func (c *RequestContext[REQ]) Method() string
- func (c *RequestContext[REQ]) SetContext(ctx context.Context)
- func (c *RequestContext[REQ]) StartSpan(name string, o ...trace.SpanStartOption) (*RequestContext[REQ], trace.Span)
Constants ¶
View Source
const (
KindKey = attribute.Key("context.key")
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct { TraceID string Values map[string]any // contains filtered or unexported fields }
func ContextFromContext ¶
func NewContext ¶
func (*Context) ContextWrapper ¶
func (*Context) SetContext ¶
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 RequestContext ¶
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 ¶
func NewRequestContext[REQ any](ctx context.Context, traceId string) *RequestContext[REQ]
func RequestContextFromContext ¶
func RequestContextFromContext[REQ any](ctx context.Context) *RequestContext[REQ]
func (*RequestContext[REQ]) Context ¶
func (c *RequestContext[REQ]) Context() context.Context
func (*RequestContext[REQ]) ContextWrapper ¶
func (c *RequestContext[REQ]) ContextWrapper() context.Context
func (*RequestContext[REQ]) Error ¶
func (c *RequestContext[REQ]) Error(args ...interface{})
func (*RequestContext[REQ]) ErrorLog ¶
func (c *RequestContext[REQ]) ErrorLog(err, originErr error, funcName string) error
func (*RequestContext[REQ]) HandleError ¶
func (c *RequestContext[REQ]) HandleError(err error)
func (*RequestContext[REQ]) Method ¶
func (c *RequestContext[REQ]) Method() string
func (*RequestContext[REQ]) SetContext ¶
func (c *RequestContext[REQ]) SetContext(ctx context.Context)
func (*RequestContext[REQ]) StartSpan ¶
func (c *RequestContext[REQ]) StartSpan(name string, o ...trace.SpanStartOption) (*RequestContext[REQ], trace.Span)
Click to show internal directories.
Click to hide internal directories.