- func Do(f func(KeyValue))
- func Publish(name string, v Var)
- type Float
- func NewFloat(name string) *Float
- func (v *Float) Add(delta float64)
- func (v *Float) Set(value float64)
- func (v *Float) String() string
- type Func
- func (f Func) String() string
- type Int
- func NewInt(name string) *Int
- func (v *Int) Add(delta int64)
- func (v *Int) Set(value int64)
- func (v *Int) String() string
- type KeyValue
- type Map
- func NewMap(name string) *Map
- func (v *Map) Add(key string, delta int64)
- func (v *Map) AddFloat(key string, delta float64)
- func (v *Map) Do(f func(KeyValue))
- func (v *Map) Get(key string) Var
- func (v *Map) Init() *Map
- func (v *Map) Set(key string, av Var)
- func (v *Map) String() string
- type String
- func NewString(name string) *String
- func (v *String) Set(value string)
- func (v *String) String() string
- type Var
- func Get(name string) Var
Package files
expvar.go
func Do
func Do(f func(KeyValue))
Do calls f for each exported variable.
The global variable map is locked during the iteration,
but existing entries may be concurrently updated.
func Publish(name string, v Var)
Publish declares a named exported variable. This should be called from a
package's init function when it creates its Vars. If the name is already
registered then this will log.Panic.
type Float struct {
// contains filtered or unexported fields
}
Float is a 64-bit float variable that satisfies the Var interface.
func NewFloat(name string) *Float
func (*Float) Add
func (v *Float) Add(delta float64)
Add adds delta to v.
func (*Float) Set
func (v *Float) Set(value float64)
Set sets v to value.
func (*Float) String
func (v *Float) String() string
type Func func() interface{}
Func implements Var by calling the function
and formatting the returned value using JSON.
func (f Func) String() string
type Int struct {
// contains filtered or unexported fields
}
Int is a 64-bit integer variable that satisfies the Var interface.
func NewInt(name string) *Int
func (*Int) Add
func (v *Int) Add(delta int64)
func (*Int) Set
func (v *Int) Set(value int64)
func (v *Int) String() string
type KeyValue struct {
Key string
Value Var
}
KeyValue represents a single entry in a Map.
type Map struct {
// contains filtered or unexported fields
}
Map is a string-to-Var map variable that satisfies the Var interface.
func NewMap(name string) *Map
func (*Map) Add
func (v *Map) Add(key string, delta int64)
func (v *Map) AddFloat(key string, delta float64)
AddFloat adds delta to the *Float value stored under the given map key.
func (*Map) Do
func (v *Map) Do(f func(KeyValue))
Do calls f for each entry in the map.
The map is locked during the iteration,
but existing entries may be concurrently updated.
func (*Map) Get
func (v *Map) Get(key string) Var
func (*Map) Init
func (v *Map) Init() *Map
func (*Map) Set
func (v *Map) Set(key string, av Var)
func (v *Map) String() string
type String struct {
// contains filtered or unexported fields
}
String is a string variable, and satisfies the Var interface.
func NewString(name string) *String
func (*String) Set
func (v *String) Set(value string)
func (*String) String
func (v *String) String() string
type Var interface {
String() string
}
Var is an abstract type for all exported variables.
func Get(name string) Var
Get retrieves a named exported variable.