ctxinfo

package module
v0.0.0-...-9ab842e Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2015 License: Apache-2.0 Imports: 3 Imported by: 2

README

ctxinfo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvContext

func EnvContext(ctx context.Context, application string) context.Context

EnvContext creates a new context containing an EnvInfo object in it's values storage.

func TxContext

func TxContext(ctx context.Context) context.Context

TxContext creates a new context containing an TxInfo object in it's values storage.

Types

type EnvInfo

type EnvInfo struct {
	Hostname    string
	Application string
}

EnvInfo stores information that are pertinent to the environment, which won't change over the execution of a program and can be safely cached.

func EnvFromContext

func EnvFromContext(ctx context.Context) EnvInfo

EnvFromContext retrieves an EnvInfo stored within a context.

func NewEnvInfo

func NewEnvInfo(application string) EnvInfo

NewEnvInfo returns a new initialized EnvInfo instance.

type Info

type Info struct {
	EnvInfo
	TxInfo
}

Info is simply a object that combines EnvInfo and TxInfo for easy of consumption.

func FromContext

func FromContext(ctx context.Context) Info

FromContext simply gets the EnvInfo and TxInfo object out of the context, returning a combined representation of it.

type TxInfo

type TxInfo struct {
	TransactionID uuid.UUID
}

Info is a struct that stores information about a specific transaction. It embeds the environment information but unlike EnvInfo, it is expected to be created multiple time over the execution of a program.

func NewTxInfo

func NewTxInfo() TxInfo

NewTxInfo returns a new initialized TxInfo instance.

func TxFromContext

func TxFromContext(ctx context.Context) TxInfo

TxFromContext retrieves an TxInfo stored within a context.

Jump to

Keyboard shortcuts

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