Documentation
¶
Overview ¶
Package context implements context management for Snyk
Index ¶
- Constants
- func Clone(ctx, newCtx context.Context) context.Context
- func DependenciesFromContext(ctx context.Context) (map[string]any, bool)
- func FilePathFromContext(ctx context.Context) types.FilePath
- func LoggerFromContext(ctx context.Context) *zerolog.Logger
- func NewContextWithDeltaScanType(ctx context.Context, dType DeltaScanType) context.Context
- func NewContextWithDependencies(ctx context.Context, dependencies map[string]any) context.Context
- func NewContextWithLogger(ctx context.Context, logger *zerolog.Logger) context.Context
- func NewContextWithScanSource(ctx context.Context, source ScanSource) context.Context
- func NewContextWithWorkDirAndFilePath(ctx context.Context, workDir, filePath types.FilePath) context.Context
- func WorkDirFromContext(ctx context.Context) types.FilePath
- type DeltaScanType
- type ScanSource
Constants ¶
View Source
const DepApiClient = "snykApiClient"
View Source
const DepAuthService = "authService"
View Source
const DepCLIExecutor = "cliExecutor"
View Source
const DepConfig = "config"
View Source
const DepErrorReporter = "errorReporter"
View Source
const DepFolderConfig = "folderConfig"
View Source
const DepInitializer = "initializer"
View Source
const DepInstrumentor = "instrumentor"
View Source
const DepLearnService = "learnService"
View Source
const DepNotifier = "notifier"
View Source
const DepScanNotifier = "scanNotifier"
View Source
const DepScanPersister = "scanPersister"
View Source
const DepScanStateAggregator = "scanStateAggregator"
View Source
const DepScanners = "scanners"
Variables ¶
This section is empty.
Functions ¶
func DependenciesFromContext ¶
DependenciesFromContext returns the dependencies stored in ctx, if any. This can be used to retrieve pointers to injected (service) dependencies, e.g. a pointer to the learn service or the cli scanner.
Returns:
- map[string]any: the dependencies stored in ctx
- bool: true if the dependencies were found, false otherwise
func NewContextWithDeltaScanType ¶
func NewContextWithDeltaScanType(ctx context.Context, dType DeltaScanType) context.Context
NewContext returns a new Context that carries value u.
func NewContextWithDependencies ¶
NewContextWithDependencies returns a new Context that carries dependencies. This can be used to pass pointers to injected (service) dependencies, e.g. a pointer to the learn service or the cli scanner.
Returns:
- context.Context: the new enriched context
func NewContextWithLogger ¶
func NewContextWithScanSource ¶
func NewContextWithScanSource(ctx context.Context, source ScanSource) context.Context
Types ¶
type DeltaScanType ¶
type DeltaScanType string
const ( Reference DeltaScanType = "Reference" WorkingDirectory DeltaScanType = "WorkingDirectory" )
func DeltaScanTypeFromContext ¶
func DeltaScanTypeFromContext(ctx context.Context) (DeltaScanType, bool)
FromContext returns the User value stored in ctx, if any.
func (DeltaScanType) String ¶
func (d DeltaScanType) String() string
type ScanSource ¶
type ScanSource string
const ( LLM ScanSource = "LLM" IDE ScanSource = "IDE" )
func ScanSourceFromContext ¶
func ScanSourceFromContext(ctx context.Context) (ScanSource, bool)
func (ScanSource) String ¶
func (s ScanSource) String() string
Click to show internal directories.
Click to hide internal directories.