Documentation ¶
Index ¶
- func FromContext(ctx context.Context) *googleContext
- type Fields
- type Getter
- type Pair
- func (p *Pair) Append(key, val interface{}) *Pair
- func (p *Pair) Fields() Fields
- func (p *Pair) Get(key interface{}) (interface{}, bool)
- func (p *Pair) GetBool(key interface{}) bool
- func (p *Pair) GetDuration(key interface{}) time.Duration
- func (p *Pair) GetFloat32(key interface{}) float32
- func (p *Pair) GetFloat64(key interface{}) float64
- func (p *Pair) GetInt(key interface{}) int
- func (p *Pair) GetInt16(key interface{}) int16
- func (p *Pair) GetInt32(key interface{}) int32
- func (p *Pair) GetInt64(key interface{}) int64
- func (p *Pair) GetInt8(key interface{}) int8
- func (p *Pair) GetString(key interface{}) string
- func (p *Pair) RemoveAll()
- func (p *Pair) Root() *Pair
- type ValueBag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns a new context object that meets the Context interface.
Types ¶
type Getter ¶
type Getter interface { GetInt(interface{}) int GetBool(interface{}) bool GetInt8(interface{}) int8 GetInt16(interface{}) int16 GetInt32(interface{}) int32 GetInt64(interface{}) int64 Get(interface{}) interface{} GetString(interface{}) string GetFloat32(interface{}) float32 GetFloat64(interface{}) float64 GetDuration(interface{}) time.Duration }
Getter defines a series of Get methods for which values will be retrieved with.
type Pair ¶
type Pair struct {
// contains filtered or unexported fields
}
Pair defines a struct for storing a linked pair of key and values.
func Append ¶
Append returns a new Pair with the giving key and with the provded Pair set as it's previous link.
func NewPair ¶
func NewPair(key, value interface{}) *Pair
NewPair returns a a key-value pair chain for setting fields.
func (*Pair) Append ¶
Append returns a new pair with the giving key and value and its previous set to this pair.
func (*Pair) GetDuration ¶
GetDuration returns the duration value of a key if it exists.
func (*Pair) GetFloat32 ¶
GetFloat32 returns the float32 value of a key if it exists.
func (*Pair) GetFloat64 ¶
GetFloat64 returns the float64 value of a key if it exists.
type ValueBag ¶
type ValueBag interface { Getter // Set adds a key-value pair into the bag. Set(key, value interface{}) // WithValue returns a new context then adds the key and value pair into the // context's store. WithValue(key interface{}, value interface{}) ValueBag }
ValueBag defines a context for holding values to be shared across processes..
func NewValueBag ¶
func NewValueBag() ValueBag
NewValueBag returns a new context object that meets the Context interface.
func ValueBagFrom ¶
func ValueBagFrom(fields map[interface{}]interface{}) ValueBag
ValueBagFrom adds giving key-value pairs into the bag.