2016-02-16 12:12:49 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Output struct {
|
|
|
|
|
|
|
|
// The keyName and value of the output
|
|
|
|
keyName string
|
2016-09-07 05:05:30 +02:00
|
|
|
value interface{}
|
2016-02-16 12:12:49 +01:00
|
|
|
}
|
|
|
|
|
2016-09-07 05:05:30 +02:00
|
|
|
func NewOutput(keyName string, value interface{}) (*Output, error) {
|
2016-02-16 12:12:49 +01:00
|
|
|
|
|
|
|
// TODO: Warn instead of silently ignore error?
|
|
|
|
if len(keyName) == 0 {
|
|
|
|
return nil, fmt.Errorf("couldn't parse keyName: %s", keyName)
|
|
|
|
}
|
|
|
|
|
|
|
|
return &Output{
|
|
|
|
keyName: keyName,
|
2016-04-09 17:27:00 +02:00
|
|
|
value: value,
|
2016-02-16 12:12:49 +01:00
|
|
|
}, nil
|
|
|
|
}
|