fix(pkg/logfile): description for public functions
This commit is contained in:
parent
3006e6f0e6
commit
afd7accb47
@ -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 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"
|
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 {
|
func AppendTemperatures(logfile Logfile, compression bool, temperatures []*types.Temperature) error {
|
||||||
|
|
||||||
allTemperatures := make([]*types.Temperature, 0)
|
allTemperatures := make([]*types.Temperature, 0)
|
||||||
@ -79,8 +80,8 @@ func CompressTemperature(temperatures []*types.Temperature) []*types.Temperature
|
|||||||
return compressedTemperatures
|
return compressedTemperatures
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a log file with basic functions for reading and writing data.
|
// New returns a log file with basic functions for reading and writing data. The
|
||||||
// The file extension of the logfile is taken into account to format the logfile
|
// file extension of the logfile is taken into account to format the logfile
|
||||||
// into the correct format.
|
// into the correct format.
|
||||||
func New(logfile string) Logfile {
|
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 {
|
func ValidateTemperatures(temperatures []*types.Temperature) error {
|
||||||
for _, temperature := range temperatures {
|
for _, temperature := range temperatures {
|
||||||
if !validUUID.MatchString(temperature.TemperatureID) {
|
if !validUUID.MatchString(temperature.TemperatureID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user