-
Notifications
You must be signed in to change notification settings - Fork 832
/
init.go
141 lines (134 loc) · 4.2 KB
/
init.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package models
import (
"sync"
"github.com/astaxie/beego/orm"
)
var (
globalOrm orm.Ormer
once sync.Once
UserModel *userModel
AppModel *appModel
AppUserModel *appUserModel
AppStarredModel *appStarredModel
NamespaceUserModel *namespaceUserModel
ClusterModel *clusterModel
DeploymentModel *deploymentModel
DeploymentTplModel *deploymentTplModel
PermissionModel *permissionModel
GroupModel *groupModel
NamespaceModel *namespaceModel
ConfigMapModel *configMapModel
ConfigMapTplModel *configMapTplModel
CronjobModel *cronjobModel
CronjobTplModel *cronjobTplModel
SecretModel *secretModel
SecretTplModel *secretTplModel
PublishStatusModel *publishStatusModel
PublishHistoryModel *publishHistoryModel
PersistentVolumeClaimModel *persistentVolumeClaimModel
PersistentVolumeClaimTplModel *persistentVolumeClaimTplModel
AuditLogModel *auditLogModel
ApiKeyModel *apiKeyModel
WebHookModel *webHookModel
StatefulsetModel *statefulsetModel
StatefulsetTplModel *statefulsetTplModel
ConfigModel *configModel
DaemonSetModel *daemonSetModel
DaemonSetTplModel *daemonSetTplModel
ChargeModel *chargeModel
InvoiceModel *invoiceModel
NotificationModel *notificationModel
NotificationLogModel *notificationLogModel
IngressModel *ingressModel
IngressTemplateModel *ingressTemplateModel
HPAModel *hpaModel
HPATemplateModel *hpaTemplateModel
)
func init() {
// init orm tables
orm.RegisterModel(
new(User),
new(App),
new(AppStarred),
new(AppUser),
new(NamespaceUser),
new(Cluster),
new(Namespace),
new(Deployment),
new(DeploymentTemplate),
new(Service),
new(ServiceTemplate),
new(Group),
new(Permission),
new(Secret),
new(SecretTemplate),
new(ConfigMap),
new(ConfigMapTemplate),
new(Cronjob),
new(CronjobTemplate),
new(PublishStatus),
new(PublishHistory),
new(PersistentVolumeClaim),
new(PersistentVolumeClaimTemplate),
new(AuditLog),
new(APIKey),
new(WebHook),
new(Statefulset),
new(StatefulsetTemplate),
new(Config),
new(DaemonSet),
new(DaemonSetTemplate),
new(Charge),
new(Invoice),
new(Notification),
new(NotificationLog),
new(Ingress),
new(IngressTemplate),
new(HPA),
new(HPATemplate))
// init models
UserModel = &userModel{}
AppModel = &appModel{}
AppUserModel = &appUserModel{}
AppStarredModel = &appStarredModel{}
NamespaceUserModel = &namespaceUserModel{}
ClusterModel = &clusterModel{}
NamespaceModel = &namespaceModel{}
DeploymentModel = &deploymentModel{}
DeploymentTplModel = &deploymentTplModel{}
GroupModel = &groupModel{}
SecretModel = &secretModel{}
SecretTplModel = &secretTplModel{}
ConfigMapModel = &configMapModel{}
ConfigMapTplModel = &configMapTplModel{}
CronjobModel = &cronjobModel{}
CronjobTplModel = &cronjobTplModel{}
PublishStatusModel = &publishStatusModel{}
PublishHistoryModel = &publishHistoryModel{}
PersistentVolumeClaimModel = &persistentVolumeClaimModel{}
PersistentVolumeClaimTplModel = &persistentVolumeClaimTplModel{}
AuditLogModel = &auditLogModel{}
ApiKeyModel = &apiKeyModel{}
WebHookModel = &webHookModel{}
StatefulsetModel = &statefulsetModel{}
StatefulsetTplModel = &statefulsetTplModel{}
ConfigModel = &configModel{}
DaemonSetModel = &daemonSetModel{}
DaemonSetTplModel = &daemonSetTplModel{}
ChargeModel = &chargeModel{}
InvoiceModel = &invoiceModel{}
NotificationModel = ¬ificationModel{}
NotificationLogModel = ¬ificationLogModel{}
IngressModel = &ingressModel{}
IngressTemplateModel = &ingressTemplateModel{}
HPAModel = &hpaModel{}
HPATemplateModel = &hpaTemplateModel{}
}
// singleton init ormer ,only use for normal db operation
// if you begin transaction,please use orm.NewOrm()
func Ormer() orm.Ormer {
once.Do(func() {
globalOrm = orm.NewOrm()
})
return globalOrm
}