Documentation ¶
Index ¶
- type AppContext
- func (sc *AppContext) Context() context.Context
- func (sc *AppContext) SetTenantID(tenantID string) AppContext
- func (sc *AppContext) SetTraceID(traceID string) AppContext
- func (sc *AppContext) SetUserID(userID string) AppContext
- func (sc *AppContext) TenantID() (string, bool)
- func (sc *AppContext) TraceID() string
- func (sc *AppContext) UserID() (string, bool)
- type ContextKey
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" )
Click to show internal directories.
Click to hide internal directories.