-
Notifications
You must be signed in to change notification settings - Fork 14
/
api_logger_entity.go
74 lines (58 loc) · 1.32 KB
/
api_logger_entity.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
73
74
package entity
import (
"time"
"github.com/latolukasz/orm"
)
const (
APILogStatusNew = "new"
APILogStatusCompleted = "completed"
APILogStatusFailed = "failed"
APILogTypeApple = "Apple"
)
type apiLogType struct {
Apple string
}
var APILogTypeAll = apiLogType{
Apple: APILogTypeApple,
}
type apiLogStatus struct {
New string
Completed string
Failed string
}
var APILogStatusAll = apiLogStatus{
New: APILogStatusNew,
Completed: APILogStatusCompleted,
Failed: APILogStatusFailed,
}
type APILogEntity struct {
orm.ORM `orm:"table=api_log;redisCache"`
ID uint64
Type string `orm:"enum=entity.APILogTypeAll;required"`
Status string `orm:"enum=entity.APILogStatusAll;required"`
Request interface{}
Response interface{}
Message string
CreatedAt time.Time `orm:"time=true"`
}
func (e *APILogEntity) SetID(value uint64) {
e.ID = value
}
func (e *APILogEntity) SetType(value string) {
e.Type = value
}
func (e *APILogEntity) SetStatus(value string) {
e.Status = value
}
func (e *APILogEntity) SetRequest(value interface{}) {
e.Request = value
}
func (e *APILogEntity) SetResponse(value interface{}) {
e.Response = value
}
func (e *APILogEntity) SetMessage(value string) {
e.Message = value
}
func (e *APILogEntity) SetCreatedAt(value time.Time) {
e.CreatedAt = value
}