refactor: combined system collections

This commit is contained in:
Marvin Zhang
2024-10-14 17:56:39 +08:00
parent e65b846427
commit 785424b1ac
2 changed files with 2 additions and 32 deletions

View File

@@ -15,37 +15,7 @@ import (
var (
typeNameColNameMap = make(map[string]string)
typeOneNameModelMap = make(map[string]any)
typeOneInstances = []any{
*new(models2.TestModelV2),
*new(models2.DataCollectionV2),
*new(models2.DatabaseV2),
*new(models2.DatabaseMetricV2),
*new(models2.DependencyV2),
*new(models2.DependencyLogV2),
*new(models2.DependencySettingV2),
*new(models2.DependencyTaskV2),
*new(models2.EnvironmentV2),
*new(models2.GitV2),
*new(models2.MetricV2),
*new(models2.NodeV2),
*new(models2.NotificationChannelV2),
*new(models2.NotificationRequestV2),
*new(models2.NotificationSettingV2),
*new(models2.PermissionV2),
*new(models2.ProjectV2),
*new(models2.RolePermissionV2),
*new(models2.RoleV2),
*new(models2.ScheduleV2),
*new(models2.SettingV2),
*new(models2.SpiderV2),
*new(models2.SpiderStatV2),
*new(models2.TaskQueueItemV2),
*new(models2.TaskStatV2),
*new(models2.TaskV2),
*new(models2.TokenV2),
*new(models2.UserRoleV2),
*new(models2.UserV2),
}
typeOneInstances = models2.GetModelInstances()
)
func init() {

View File

@@ -79,6 +79,7 @@ func GetModelInstances() []any {
*new(GitV2),
*new(MetricV2),
*new(NodeV2),
*new(NotificationAlertV2),
*new(NotificationChannelV2),
*new(NotificationRequestV2),
*new(NotificationSettingV2),
@@ -116,7 +117,6 @@ func GetCollectionNameByInstance(v any) string {
return field.Tag.Get("collection")
}
// Add this new function
func GetSystemModelColNamesMap() map[string]bool {
colNamesMap := make(map[string]bool)
for _, instance := range GetModelInstances() {