Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FtoC = Func{ Name: "FtoC", Fn: func(value interface{}) (interface{}, error) { f, err := utils.ConvertToFloat64(value) if err != nil { return nil, err } c := float64((f - 32.0) * 5.0 / 9.0) return c, nil }, }
FtoC is a Func which converts a value from degrees Fahrenheit to degrees Celsius.
Functions ¶
Types ¶
type Func ¶
type Func struct {
// Name is the name of the function. This is how it is identified
// and referenced.
Name string
// Fn is the function which will be called on the reading value.
Fn func(value interface{}) (interface{}, error)
}
Func is a function that can be applied to a device reading.
func Get ¶
Get gets a Func by its name. If a func with the specified name is not found, nil is returned.
func GetBuiltins ¶
func GetBuiltins() []*Func
GetBuiltins returns all the built-in Funcs supplied by the SDK.
Click to show internal directories.
Click to hide internal directories.