/
timeseriesrow.go
83 lines (60 loc) · 1.81 KB
/
timeseriesrow.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package gaia
import (
"fmt"
"github.com/mitchellh/copystructure"
"go.aporeto.io/elemental"
)
// TimeSeriesRow represents the model of a timeseriesrow
type TimeSeriesRow struct {
// Columns of the row.
Columns []string `json:"columns" msgpack:"columns" bson:"-" mapstructure:"columns,omitempty"`
// Name of the row.
Name string `json:"name" msgpack:"name" bson:"-" mapstructure:"name,omitempty"`
// List of tags.
Tags map[string]string `json:"tags" msgpack:"tags" bson:"-" mapstructure:"tags,omitempty"`
// List of tags.
Values [][]interface{} `json:"values" msgpack:"values" bson:"-" mapstructure:"values,omitempty"`
ModelVersion int `json:"-" msgpack:"-" bson:"_modelversion"`
}
// NewTimeSeriesRow returns a new *TimeSeriesRow
func NewTimeSeriesRow() *TimeSeriesRow {
return &TimeSeriesRow{
ModelVersion: 1,
Columns: []string{},
Tags: map[string]string{},
Values: [][]interface{}{},
}
}
// BleveType implements the bleve.Classifier Interface.
func (o *TimeSeriesRow) BleveType() string {
return "timeseriesrow"
}
// DeepCopy returns a deep copy if the TimeSeriesRow.
func (o *TimeSeriesRow) DeepCopy() *TimeSeriesRow {
if o == nil {
return nil
}
out := &TimeSeriesRow{}
o.DeepCopyInto(out)
return out
}
// DeepCopyInto copies the receiver into the given *TimeSeriesRow.
func (o *TimeSeriesRow) DeepCopyInto(out *TimeSeriesRow) {
target, err := copystructure.Copy(o)
if err != nil {
panic(fmt.Sprintf("Unable to deepcopy TimeSeriesRow: %s", err))
}
*out = *target.(*TimeSeriesRow)
}
// Validate valides the current information stored into the structure.
func (o *TimeSeriesRow) Validate() error {
errors := elemental.Errors{}
requiredErrors := elemental.Errors{}
if len(requiredErrors) > 0 {
return requiredErrors
}
if len(errors) > 0 {
return errors
}
return nil
}