Documentation
¶
Index ¶
- Variables
- func ContextSilent() (ctx context.Context)
- func ContextVerbose() (ctx context.Context)
- func GetLogLinePrefixFromCtx(ctx context.Context) (logLinePrefix string)
- func GetVerboseFromContext(ctx context.Context) (verbose bool)
- func GetVerbosityContextByBool(verbose bool) (ctx context.Context)
- func GetVerbosityContextByCobraCmd(cmd *cobra.Command) (ctx context.Context)
- func IsCacheIndicatorPresent(ctx context.Context) bool
- func IsCachedResult(ctx context.Context) (bool, error)
- func SetCacheIndicator(ctx context.Context, cached bool)
- func WithCacheIndicator(ctx context.Context) context.Context
- func WithLogLinePrefix(ctx context.Context, logLinePrefix string) (ctxWithLogLinePrefix context.Context)
- func WithVerbosityContextByBool(ctx context.Context, verbose bool) (ctxWithVerbosity context.Context)
- type CacheIndicator
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorNoCacheIndicatorPresent = errors.New("no cache indicator present in given contest")
Functions ¶
func ContextSilent ¶
func ContextVerbose ¶
func GetLogLinePrefixFromCtx ¶
func GetVerboseFromContext ¶
func IsCacheIndicatorPresent ¶ added in v0.295.0
func IsCachedResult ¶ added in v0.295.0
true means the returned result bases on cached data, false means no cache was involved. If ctx has no CacheInidicator as Value it an error is returned.
func SetCacheIndicator ¶ added in v0.295.0
Use this to set the cache indication. Set the parameter 'cached' to true to indiacte the given result bases on caching.
If no cache indicator is present or ctx is nil the ctx stays untouched. This allows to use SetCahceIndicator wherever you want but it's only changing ctx if requested by a ctx with change indicator.
func WithCacheIndicator ¶ added in v0.295.0
Get a child context containing an cache indicator which can indicate if a result bases on cached data or not.
func WithLogLinePrefix ¶
Types ¶
type CacheIndicator ¶ added in v0.295.0
type CacheIndicator struct { // true indicates you received a cached result. CachedResult bool }
Click to show internal directories.
Click to hide internal directories.