Updated for go 1.16 modules
This commit is contained in:
parent
8278d7b471
commit
38d9c881b3
25 changed files with 25 additions and 19 deletions
21
pkg/spool/serialize.go
Normal file
21
pkg/spool/serialize.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package spool
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job"
|
||||
)
|
||||
|
||||
// Serialize writes a spool on the disk
|
||||
func Serialize(handle io.Writer, jobs []job.Job) error {
|
||||
lines := make([][]string, len(jobs))
|
||||
for i := 0; i < len(jobs); i++ {
|
||||
job := jobs[i]
|
||||
lines[i] = make([]string, 2)
|
||||
lines[i][0] = job.Name
|
||||
lines[i][1] = fmt.Sprintf("%d", job.Timestamp)
|
||||
}
|
||||
return csv.NewWriter(handle).WriteAll(lines)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue