fact

package
v0.9.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fact exposes contextual information about the environment and the requests being made to a server. It works with the context package to store and retrieve information.

This package follows the general pattern in use for golang.org/x/net/context. For each fact named X, there are two methods provided: (1) a getter with the signature X(context) (X, bool), and (2) a setter with the signature SetX(context, X) context.

Index

Constants

This section is empty.

Variables

View Source
var (
	NoLogger   = errors.New("No Logger found in context")
	NoDeviceId = errors.New("No deviceId found in context")
	NoConvey   = errors.New("No convey payload found in context")
	NoToken    = errors.New("No secure token found in context")
)

Functions

func Convey

func Convey(ctx context.Context) (device.Convey, bool)

Convey retrieves the device.Convey from the enclosing context

func DeviceId

func DeviceId(ctx context.Context) (device.ID, bool)

DeviceId retrieves the device.ID of the device from the enclosing context

func Logger

func Logger(ctx context.Context) (logging.Logger, bool)

Logger retrieves the logging.Logger from the enclosing context

func MustConvey

func MustConvey(ctx context.Context) device.Convey

MustConvey retrieves the convey payload from the context, panicking if no such payload is found.

func MustDeviceId

func MustDeviceId(ctx context.Context) device.ID

MustDeviceId retrieves the device.ID from the context, panicking if no such device id is found.

func MustLogger

func MustLogger(ctx context.Context) logging.Logger

MustLogger retrieves the logging.Logger from the context, panicking if no such logger is found.

func MustToken

func MustToken(ctx context.Context) *secure.Token

MustToken retrieves the secure token from the context, panicking if no such token is found.

func SetConvey

func SetConvey(ctx context.Context, value device.Convey) context.Context

SetConvey sets the device.Convey in the enclosing context

func SetDeviceId

func SetDeviceId(ctx context.Context, value device.ID) context.Context

SetDeviceId sets the device.ID of the device in the enclosing context

func SetLogger

func SetLogger(ctx context.Context, value logging.Logger) context.Context

SetLogger sets the logging.Logger in the enclosing context

func SetToken

func SetToken(ctx context.Context, value *secure.Token) context.Context

SetToken sets the secure.Token in the enclosing context

func Token

func Token(ctx context.Context) (*secure.Token, bool)

Token retrieves the secure.Token from the enclosing context

Types

This section is empty.

Jump to

Keyboard shortcuts

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