From afd7accb472d8e773a640f82ba4e0a40770210ec Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Fri, 21 Jun 2019 14:31:56 +0200 Subject: [PATCH] fix(pkg/logfile): description for public functions --- pkg/logfile/logfile.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/logfile/logfile.go b/pkg/logfile/logfile.go index bba4698..4533d19 100644 --- a/pkg/logfile/logfile.go +++ b/pkg/logfile/logfile.go @@ -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) {