Documentation
¶
Overview ¶
Package slackcontext defines getters and setters for execution-scoped values that are propagated through context.Context during the execution of a Slack command. These values may include unique identifiers, session metadata, host information, version details, and other execution data.
All values should be set in the context before a Slack command begins execution. The values can then be accessed throughout the command's execution lifecycle using the provided getter methods.
Each value is stored with an unexported key type to prevent collisions with other packages using context values. The package provides type-safe accessors for retrieving these values.
Index ¶
- func MockContext(ctx context.Context) context.Context
- func SessionID(ctx context.Context) (string, error)
- func SetProjectID(ctx context.Context, projectID string) context.Context
- func SetSessionID(ctx context.Context, sessionID string) context.Context
- func SetSystemID(ctx context.Context, systemID string) context.Context
- func SetTraceID(ctx context.Context, traceID string) context.Context
- func SetVersion(ctx context.Context, version string) context.Context
- func TraceID(ctx context.Context) (string, error)
- func Version(ctx context.Context) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockContext ¶
MockContext sets values in the context that are guaranteed to exist before the Cobra root command is executed.
func SessionID ¶
SessionID returns the session ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no session ID could be found.
func SetProjectID ¶
SetProjectID returns a new `context.Context` that holds a reference to the `projectID` and sets the `project_id` attribute on the span in `ctx`.
func SetSessionID ¶
SetSessionID returns a new `context.Context` that holds a reference to the `sessionID`.
func SetSystemID ¶
SetSystemID returns a new `context.Context` that holds a reference to the `systemID` and sets the `system_id` attribute on the span in `ctx`.
func SetVersion ¶
SetVersion adds the slack-cli version to Golang context for trace logging
Types ¶
This section is empty.