-
Notifications
You must be signed in to change notification settings - Fork 0
/
ack.go
38 lines (33 loc) · 887 Bytes
/
ack.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
package service
import (
"fmt"
"time"
)
// Ack
type Ack struct {
Version int `json:"ack_version"`
Agent string `json:"agent"`
Uuid string `json:"ack_uuid"`
RequestUuid string `json:"req_uuid"`
DateTime string `json:"date_time"`
Success bool `json:"success"`
ServerCode int `json:"server_code"`
Location string `json:"location"`
PayloadType string `json:"payload_type"`
Payload interface{} `json:"payload"`
Duration string `json:"duration"`
instTime time.Time
}
// StartTimer
func (a *Ack) StartTimer() {
a.instTime = time.Now()
}
// SetPayload
func (a *Ack) SetPayload(payload interface{}) {
a.Duration = fmt.Sprintf("%s", time.Since(a.instTime))
a.Payload = payload
}
// SetPayloadType
func (a *Ack) SetPayloadType(payloadType string) {
a.PayloadType = payloadType
}