-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
40 lines (34 loc) · 794 Bytes
/
model.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
package kit
import "fmt"
type Result struct {
Success bool `json:"success"`
Result interface{} `json:"result"`
Error Error `json:"error"`
}
type Error struct {
Code int `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Details interface{} `json:"details,omitempty"`
}
type StatusMessage struct {
StatusCode int
Result Result
}
type ArrayResult struct {
TotalCount int `json:"totalCount"`
Items interface{} `json:"items"`
}
type (
APIParam struct {
Q string
SkipCount int
MaxResultCount int
Fields string
Sort string
SortAsc string
SortDesc string
}
)
func (e Error) Error() string {
return fmt.Sprintf("[%d]%v-%v", e.Code, e.Message, e.Details)
}