Skip to content

Commit

Permalink
feat(global-config): 移除util包并优化全局配置处理逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
zouxingyuks committed Dec 20, 2024
1 parent 8520b94 commit 57c78b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 50 deletions.
5 changes: 2 additions & 3 deletions cmd/data-service/service/global-config/global_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
dtypes "hcm/pkg/dal/table/types"
"hcm/pkg/logs"
"hcm/pkg/rest"
"hcm/pkg/tools/util"

"github.com/jmoiron/sqlx"
)
Expand All @@ -57,7 +56,7 @@ func (svc *service) BatchCreateGlobalConfigs(cts *rest.Contexts) (interface{}, e
for index, config := range req.Configs {
globalConfigs[index] = tablegconf.GlobalConfigTable{
ConfigKey: config.ConfigKey,
ConfigValue: dtypes.JsonField(util.GetStrByInterface(config.ConfigValue)),
ConfigValue: dtypes.JsonField(config.ConfigValue),
ConfigType: config.ConfigType,
Memo: config.Memo,
Creator: cts.Kit.User,
Expand Down Expand Up @@ -133,7 +132,7 @@ func (svc *service) BatchUpdateGlobalConfigs(cts *rest.Contexts) (interface{}, e
}

if config.ConfigValue != nil {
record.ConfigValue = dtypes.JsonField(util.GetStrByInterface(config.ConfigValue))
record.ConfigValue = dtypes.JsonField(config.ConfigValue)
}

if config.Memo != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/api/core/global-config/global_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
// Package core ...
package core

import "encoding/json"

// GlobalConfig ...
type GlobalConfig struct {
// ID global config id
ID string `json:"id"`
// ConfigKey global config key, key+type is unique
ConfigKey string `json:"config_key"`
// ConfigValue global config value, json format
ConfigValue interface{} `json:"config_value"`
ConfigValue json.RawMessage `json:"config_value"`
// ConfigType global config type
ConfigType string `json:"config_type"`
// Memo global config memo
Expand Down
46 changes: 0 additions & 46 deletions pkg/tools/util/conv.go

This file was deleted.

0 comments on commit 57c78b3

Please sign in to comment.