outputs

package
v0.0.0-...-f87f656 Latest Latest
Warning

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

Go to latest
Published: May 20, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback interface {
	Handle(measurement.Sample) error
}

Callback is an interface which allows taking arbitrary datapoints and doing some processing on them

type ChainCallback

type ChainCallback struct {
	// contains filtered or unexported fields
}

ChainCallback can be used to include multiple sub-callback implementations into a single callback handler

func NewChainCallback

func NewChainCallback() *ChainCallback

NewChainCallback returns an empty ChainCallback

func (*ChainCallback) Handle

func (cc *ChainCallback) Handle(s measurement.Sample) error

Handle iterates through all registered callbacks and executes them

func (*ChainCallback) RegisterCallback

func (cc *ChainCallback) RegisterCallback(scb Callback)

RegisterCallback adds a callback function to the list of callbacks in the chain

type InfluxDBCallback

type InfluxDBCallback struct {
	// contains filtered or unexported fields
}

InfluxDBCallback sends sensor data to a specified InfluxDB endpoint

func NewInfluxDBCallback

func NewInfluxDBCallback(addr string, database string) (*InfluxDBCallback, error)

NewInfluxDBCallback returns an InfluxDBCallback that can be used to send sensor data to the configured influxDB endpoint. The passed in tags will be included in every callback invocation

func (*InfluxDBCallback) Handle

func (icb *InfluxDBCallback) Handle(s measurement.Sample) error

Handle sends sensor data to the configured InfluxDB database

type LoggingCallback

type LoggingCallback struct {
	// contains filtered or unexported fields
}

LoggingCallback includes structured logging for data

func NewLoggingCallback

func NewLoggingCallback(l *zap.Logger) *LoggingCallback

NewLoggingCallback returns a LoggingCallback

func (*LoggingCallback) Handle

func (l *LoggingCallback) Handle(s measurement.Sample) error

Handle is a function that adheres to the Callback interface Use this function after generating the struct to pass into the SetCallback function to use this method as a callback for temperature readings The intermediate struct is because this callback is stateful due to the logger needing to be predefined (this makes the logger more flexible in config)

type StdoutCallback

type StdoutCallback struct{}

StdoutCallback is a basic printing callback handler

func NewStdoutCallback

func NewStdoutCallback() *StdoutCallback

NewStdoutCallback returns a new stdout callback... it just prints things to stdout.

func (*StdoutCallback) Handle

func (sc *StdoutCallback) Handle(s measurement.Sample) error

Handle is a simple callback that just prints to stdout

Jump to

Keyboard shortcuts

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