forked from realvnc-labs/tacoscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptResult.go
More file actions
43 lines (33 loc) · 1.05 KB
/
scriptResult.go
File metadata and controls
43 lines (33 loc) · 1.05 KB
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
package script
import (
"time"
)
type scriptResult struct {
Results []taskResult
Summary scriptSummary
}
type taskResult struct {
ID string `yaml:"ID"`
Function string `yaml:"Function"`
Name string `yaml:"Name"`
Result bool `yaml:"Result"`
Comment string `yaml:"Comment,omitempty"`
Error string `yaml:"Error,omitempty"`
Started onlyTime `yaml:"Started"`
Duration time.Duration `yaml:"Duration"`
Changes map[string]interface{} `yaml:"Changes,omitempty"` // map for custom key-val data depending on type
}
type scriptSummary struct {
Script string `yaml:"Script"`
Succeeded int `yaml:"Succeeded"`
Failed int `yaml:"Failed"`
Aborted int `yaml:"Aborted"`
Changes int `yaml:"Changes"`
TotalTasksRun int `yaml:"TotalTasksRun"`
TotalRunTime time.Duration `yaml:"TotalRunTime"`
}
const stampMicro = "15:04:05.000000"
type onlyTime time.Time
func (c onlyTime) MarshalYAML() (interface{}, error) {
return time.Time(c).Format(stampMicro), nil
}