Skip to content

Commit

Permalink
refactor: combined system collections
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Oct 14, 2024
1 parent e65b846 commit 785424b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
32 changes: 1 addition & 31 deletions core/grpc/server/model_base_service_v2_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion core/models/models/v2/base_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func GetModelInstances() []any {
*new(GitV2),
*new(MetricV2),
*new(NodeV2),
*new(NotificationAlertV2),
*new(NotificationChannelV2),
*new(NotificationRequestV2),
*new(NotificationSettingV2),
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 785424b

Please sign in to comment.