/
decoders.go
61 lines (45 loc) · 1.23 KB
/
decoders.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
package baghdad
import (
"bytes"
"encoding/gob"
)
// DecodeBuildJob is used to parse a BuildJob from a rabbitmq msg
func DecodeBuildJob(p []byte) (bj BuildJob, err error) {
bj = BuildJob{}
buf := bytes.NewBuffer(p)
dec := gob.NewDecoder(buf)
err = dec.Decode(&bj)
return
}
// DecodeBuildEvent is used to parse a BuildEvent from a rabbitmq msg
func DecodeBuildEvent(p []byte) (be BuildEvent, err error) {
be = BuildEvent{}
buf := bytes.NewBuffer(p)
dec := gob.NewDecoder(buf)
err = dec.Decode(&be)
return
}
// DecodeDeployJob is used to parse a DeployJob from a rabbitmq msg
func DecodeDeployJob(p []byte) (dj DeployJob, err error) {
dj = DeployJob{}
buf := bytes.NewBuffer(p)
dec := gob.NewDecoder(buf)
err = dec.Decode(&dj)
return
}
// DecodePostDeployJob is used to parse a DeployJob from a rabbitmq msg
func DecodePostDeployJob(p []byte) (pdj PostDeployJob, err error) {
pdj = PostDeployJob{}
buf := bytes.NewBuffer(p)
dec := gob.NewDecoder(buf)
err = dec.Decode(&pdj)
return
}
// DecodeSecretsJob is used to parse a SecretsJob from a rabbitmq msg
func DecodeSecretsJob(p []byte) (sj SecretsJob, err error) {
sj = SecretsJob{}
buf := bytes.NewBuffer(p)
dec := gob.NewDecoder(buf)
err = dec.Decode(&sj)
return
}