context

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: GPL-3.0 Imports: 9 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 GetIpFromCtx added in v1.17.0

func GetIpFromCtx(ctx context.Context) string

func GetRequestUrlFromCtx added in v1.20.0

func GetRequestUrlFromCtx(ctx context.Context) string

func GetTraceIdFromContext

func GetTraceIdFromContext(ctx context.Context) string

func GetUserIdFromContext

func GetUserIdFromContext(ctx context.Context) string

func InsertAllInfo added in v1.20.0

func InsertAllInfo(ctx context.Context) context.Context

func InsertRemoteIp added in v1.4.0

func InsertRemoteIp(ctx context.Context) context.Context

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) Deadline added in v1.17.0

func (tc *TrContext) Deadline() (time.Time, bool)

func (*TrContext) Done added in v1.17.0

func (tc *TrContext) Done() <-chan struct{}

func (*TrContext) Err added in v1.17.0

func (tc *TrContext) Err() error

func (*TrContext) GetExtraValue

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

func (*TrContext) SetExtraKeyValue

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

func (*TrContext) Value added in v1.17.0

func (tc *TrContext) Value(key interface{}) interface{}

Jump to

Keyboard shortcuts

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