-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdata.go
More file actions
52 lines (45 loc) · 964 Bytes
/
data.go
File metadata and controls
52 lines (45 loc) · 964 Bytes
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
package main
import "strconv"
type DataType int
const (
ServerDefault DataType = iota
ConnectData
MessageData
JsonData
)
type LogLine struct {
Index int64 `json:"index"`
Callsign string `json:"callsign"`
Dt string `json:"dt"`
Freq string `json:"freq"`
Mode string `json:"mode"`
Rst any `json:"rst"`
RRig string `json:"rrig"`
RAnt string `json:"rant"`
RPwr string `json:"rpwr"`
RQth string `json:"rqth"`
TRig string `json:"trig"`
TAnt string `json:"tant"`
TPwr string `json:"tpwr"`
TQth string `json:"tqth"`
Rmks string `json:"rmks"`
}
func (ll LogLine) getRst() string {
switch v := ll.Rst.(type) {
case float64:
return strconv.Itoa(int(v))
case string:
return v
default:
return ""
}
}
type Data struct {
Type DataType `json:"type"`
Message string `json:"message"`
Payload LogLine `json:"payload"`
}
type ExportData struct {
Name string
Data []LogLine
}