fix(pkg/logfile): description for public functions

This commit is contained in:
Markus Pesch 2019-06-21 14:31:56 +02:00
parent 3006e6f0e6
commit afd7accb47
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -13,7 +13,8 @@ import (
var validUUID = regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$")
var timeFormat = "2006-01-02 15:04:05.999999999 -0700"
// AppendTemperatures with temperature values from a logfile. As additional option it's possible to compress the temperature data.
// AppendTemperatures with temperature values from a logfile. As additional
// option it's possible to compress the temperature data.
func AppendTemperatures(logfile Logfile, compression bool, temperatures []*types.Temperature) error {
allTemperatures := make([]*types.Temperature, 0)
@ -79,8 +80,8 @@ func CompressTemperature(temperatures []*types.Temperature) []*types.Temperature
return compressedTemperatures
}
// New returns a log file with basic functions for reading and writing data.
// The file extension of the logfile is taken into account to format the logfile
// New returns a log file with basic functions for reading and writing data. The
// file extension of the logfile is taken into account to format the logfile
// into the correct format.
func New(logfile string) Logfile {
@ -129,6 +130,10 @@ func SortTemperatures(temperatures []*types.Temperature) {
})
}
// ValidateTemperatures Checks if the temperature data is valid.
// - Check the temperature id (uuid)
// - Checks whether the time specifications are historically in a sequence.
// - Check the sensor id (uuid)
func ValidateTemperatures(temperatures []*types.Temperature) error {
for _, temperature := range temperatures {
if !validUUID.MatchString(temperature.TemperatureID) {