-
Notifications
You must be signed in to change notification settings - Fork 2
/
model.go
98 lines (78 loc) · 2.66 KB
/
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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package storage
import (
"time"
"github.com/allegro/bigcache/v2"
"google.golang.org/api/drive/v3"
)
// Begin Database Connection Models //
// Config model for database config
type Config struct {
LIKE LIKE `json:"like,omitempty"`
MongoDB MongoDB `json:"mongodb,omitempty"`
Redis Redis `json:"redis,omitempty"`
CustomKeyValue CustomKeyValue `json:"customKeyValue,omitempty"`
BigCache bigcache.Config `json:"bigCache,omitempty"`
GoogleDrive GoogleDrive `json:"googleDrive,omitempty"`
CustomFile CustomFile `json:"customFile,omitempty"`
}
// LIKE model for SQL-LIKE connection config
type LIKE struct {
DriverName string `json:"driverName"`
DataSourceName string `json:"dataSourceName"`
MaxConnectionLifetime time.Duration `json:"maxConnectionLifetime"`
MaxConnectionIdle int `json:"maxConnectionIdle"`
MaxConnectionOpen int `json:"maxConnectionOpen"`
}
// MongoDB model for MongoDB connection config
type MongoDB struct {
User string `json:"user"`
Password string `json:"password"`
Hosts []string `json:"hosts"`
DB string `json:"db"`
Options []string `json:"options"`
}
// Redis model for redis config
type Redis struct {
Password string `json:"password"`
Host string `json:"host"`
DB int `json:"db"`
MaxRetries int `json:"maxRetries"`
}
// CustomKeyValue config model
type CustomKeyValue struct {
MemorySize int64 `json:"memorySize"` // byte
CleaningEnable bool `json:"cleaningEnable"`
CleaningInterval time.Duration `json:"cleaningInterval"` // nanosecond
}
// GoogleDrive config model
type GoogleDrive struct {
PoolSize int `json:"poolSize"`
ByHTTPClient bool `json:"byHTTPClient"`
Token string `json:"token"`
Credential string `json:"credential"`
}
// CustomFile config model
type CustomFile struct {
PoolSize int `json:"poolSize"`
RootServiceDirectory string `json:"rootDirectory"`
}
// End Database Connection Models //
// -------------------------------------------------------------------------
// Begin Caching Models //
// customKeyValueItem private model for custom key-value record
type customKeyValueItem struct {
data interface{}
expires int64
}
// End Caching Models //
// -------------------------------------------------------------------------
// Begin File Models //
// GoogleFileListModel for unmarshal object has interface type
type GoogleFileListModel struct {
drive.FileList
}
// GoogleFileModel for unmarshal object has interface type
type GoogleFileModel struct {
drive.File
}
// End Caching Models //