context

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTraceID

func AddTraceID(ctx context.Context, traceId string) context.Context

func AddUserID

func AddUserID(ctx context.Context, userId string) context.Context

func GenTraceID

func GenTraceID() string

func GetContextWithTraceId

func GetContextWithTraceId() context.Context

func GetTraceIdFromContext

func GetTraceIdFromContext(ctx context.Context) string

func GetUserIdFromContext

func GetUserIdFromContext(ctx context.Context) string

func InsertTraceID

func InsertTraceID(ctx context.Context) context.Context

Types

type TrContext

type TrContext struct {
	context.Context
	TraceId    string         `json:"traceId,omitempty"`
	UserId     int64          `json:"userId,omitempty"`
	OpId       int64          `json:"opId,omitempty"`
	RunAs      int64          `json:"runAs,omitempty"`
	Roles      string         `json:"roles,omitempty"`
	BizTypes   int            `json:"bizTypes,omitempty"`
	GroupId    int64          `json:"groupId,omitempty"`
	Platform   string         `json:"platform,omitempty"`
	UserAgent  string         `json:"userAgent,omitempty"`
	Lang       string         `json:"lang,omitempty"`
	GoId       uint64         `json:"goId,omitempty"`
	Token      string         `json:"token,omitempty"`
	ShareToken string         `json:"shareToken,omitempty"`
	RemoteIp   string         `json:"remoteIp,omitempty"`
	CompanyId  int64          `json:"companyId,omitempty"`
	Product    int            `json:"product,omitempty"`
	Extra      map[string]any `json:"extra,omitempty"`
}

func (*TrContext) GetExtraValue

func (ctx *TrContext) GetExtraValue(key string) any

func (*TrContext) SetExtraKeyValue

func (ctx *TrContext) SetExtraKeyValue(key string, val any)

Jump to

Keyboard shortcuts

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