-
Notifications
You must be signed in to change notification settings - Fork 36
/
filter.go
39 lines (34 loc) · 871 Bytes
/
filter.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
package main
import (
"sort"
)
type ResponseStage struct {
Type string `yaml:"type"`
Lookup string `yaml:"lookup"`
Frequency float64 `yaml:"frequency"`
InputRate float64 `yaml:"inputrate"`
SampleRate float64 `yaml:"samplerate"`
Decimate int32 `yaml:"decimate"`
Gain float64 `yaml:"gain"`
Scale float64 `yaml:"scale"`
Correction float64 `yaml:"correction"`
Delay float64 `yaml:"delay"`
InputUnits string `yaml:"inputunits"`
OutputUnits string `yaml:"outputunits"`
}
type filterMap map[string][]ResponseStage
func (f filterMap) Keys() []string {
var keys []string
for k := range f {
keys = append(keys, k)
}
sort.Strings(keys)
return keys
}
func (f filterMap) Values() [][]ResponseStage {
var values [][]ResponseStage
for _, k := range f.Keys() {
values = append(values, f[k])
}
return values
}