context

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package context holds the last resort overrides and fyi objects that can be passed to clients and transports added to context.Context objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerFrom

func LoggerFrom(ctx context.Context) *zap.SugaredLogger

LoggerFrom returns the logger stored in context.

func TargetFrom

func TargetFrom(ctx context.Context) *url.URL

TargetFrom looks in the given context and returns `target` as a parsed url if found and valid, otherwise nil.

func TopicFrom

func TopicFrom(ctx context.Context) string

TopicFrom looks in the given context and returns `topic` as a string if found and valid, otherwise "".

func WithLogger

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger returns a new context with the logger injected into the given context.

func WithTarget

func WithTarget(ctx context.Context, target string) context.Context

WithTarget returns back a new context with the given target. Target is intended to be transport dependent. For http transport, `target` should be a full URL and will be injected into the outbound http request.

func WithTopic

func WithTopic(ctx context.Context, topic string) context.Context

WithTopic returns back a new context with the given topic. Topic is intended to be transport dependent. For pubsub transport, `topic` should be a Pub/Sub Topic ID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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