appcontext

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppContext

type AppContext struct {
	// contains filtered or unexported fields
}

AppContext carries the context of the current execution.

func FromContext

func FromContext(ctx context.Context) AppContext

FromContext returns a new AppContext from a context.Context

func NewAppContext

func NewAppContext(ctx context.Context) AppContext

NewContext returns a new AppContext

func (*AppContext) Context

func (sc *AppContext) Context() context.Context

Context returns the context.Context

func (*AppContext) SetTenantID

func (sc *AppContext) SetTenantID(tenantID string) AppContext

SetTenantID sets the user id

func (*AppContext) SetTraceID

func (sc *AppContext) SetTraceID(traceID string) AppContext

SetTraceID sets the trace id

func (*AppContext) SetUserID

func (sc *AppContext) SetUserID(userID string) AppContext

SetUserID sets the user id

func (*AppContext) TenantID

func (sc *AppContext) TenantID() (string, bool)

TenantID returns the tenant id

func (*AppContext) TraceID

func (sc *AppContext) TraceID() string

TraceID returns the trace identifier for the current flow

func (*AppContext) UserID

func (sc *AppContext) UserID() (string, bool)

UserID returns the user id

type ContextKey

type ContextKey string
const (
	TraceIDKey  ContextKey = "trace_id"
	UserIDKey   ContextKey = "user_id"
	TenantIDKey ContextKey = "tenant_id"
)

Jump to

Keyboard shortcuts

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