/
data.go
72 lines (56 loc) · 1.45 KB
/
data.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
62
63
64
65
66
67
68
69
70
71
72
package flow
import (
"encoding/json"
)
type Payload []byte
type Attachment struct {
Data []byte
File string
MimeType string
}
type Data struct {
RequestID string `json:"request_id"`
Payload Payload `json:"payload"`
Status string `json:"status"`
Flow string `json:"flow"`
Operation string `json:"operation"`
FailedReason error `json:"failed_reason"`
UserID uint `json:"user_id"`
TimeStamp int64 `json:"time_stamp"`
Download bool `json:"download"`
FileName string `json:"file_name"`
Attachments []Attachment `json:"attachments"`
}
func (d *Data) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, d)
}
func (d *Data) MarshalBinary() ([]byte, error) {
return json.Marshal(d)
}
func (d *Data) ConvertTo(rs interface{}) error {
return json.Unmarshal(d.Payload, rs)
}
func (d *Data) ToString() string {
return string(d.Payload)
}
func (d *Data) GetStatus() string {
return d.Status
}
func (d *Data) Log() error {
return nil
}
func (d *Data) LogRecords(count ...int64) error {
return nil
}
func (d *Data) logUserCount(prefix, date string, count ...int64) error {
return nil
}
func (d *Data) logUserFlowCount(prefix, date string, count ...int64) error {
return nil
}
func (d *Data) logUserFlowOperationCount(prefix, date string) error {
return nil
}
func (d *Data) logUserFlowOperation(prefix string) error {
return nil
}