context

package
v1.1303.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package context implements context management for Snyk

Index

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 Clone

func Clone(ctx, newCtx context.Context) context.Context

func DependenciesFromContext

func DependenciesFromContext(ctx context.Context) (map[string]any, bool)

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 FilePathFromContext

func FilePathFromContext(ctx context.Context) types.FilePath

func LoggerFromContext

func LoggerFromContext(ctx context.Context) *zerolog.Logger

func NewContextWithDeltaScanType

func NewContextWithDeltaScanType(ctx context.Context, dType DeltaScanType) context.Context

NewContext returns a new Context that carries value u.

func NewContextWithDependencies

func NewContextWithDependencies(ctx context.Context, dependencies map[string]any) context.Context

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 NewContextWithLogger(ctx context.Context, logger *zerolog.Logger) context.Context

func NewContextWithScanSource

func NewContextWithScanSource(ctx context.Context, source ScanSource) context.Context

func NewContextWithWorkDirAndFilePath

func NewContextWithWorkDirAndFilePath(ctx context.Context, workDir, filePath types.FilePath) context.Context

func WorkDirFromContext

func WorkDirFromContext(ctx context.Context) types.FilePath

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

Jump to

Keyboard shortcuts

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