MSP-5014 interface{} -> any
This commit is contained in:
1 parent
da38973037
commit
24a6522d57
4 files changed
+12
-11
No files matched your search
+2
-2
@@ -24,7 +24,7 @@ type Config struct {
|
||||
ModuleId string
|
||||
Version int32
|
||||
Active bool
|
||||
Data map[string]interface{}
|
||||
Data map[string]any
|
||||
Unsafe bool
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ type CommonConfig struct {
|
||||
Description string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Data map[string]interface{}
|
||||
Data map[string]any
|
||||
}
|
||||
|
||||
type Connection struct {
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ func (s schemaCommand) action(ctx *cli.Context) error {
|
||||
moduleName := ctx.Args().First()
|
||||
|
||||
if schemaConfig := s.getSchemaConfig(moduleName); schemaConfig != nil {
|
||||
schema := make(map[string]interface{})
|
||||
schema := make(map[string]any)
|
||||
schema["title"] = moduleName
|
||||
schema["schema"] = schemaConfig
|
||||
switch ctx.String(flag.OutPrintSchema.Name) {
|
||||
@@ -51,7 +51,7 @@ func (s schemaCommand) action(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s schemaCommand) getSchemaConfig(moduleName string) interface{} {
|
||||
func (s schemaCommand) getSchemaConfig(moduleName string) any {
|
||||
if configuration, err := service.Config.GetConfigurationByModuleName(moduleName); err != nil {
|
||||
utils.PrintError(err)
|
||||
return nil
|
||||
@@ -63,7 +63,7 @@ func (s schemaCommand) getSchemaConfig(moduleName string) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
func (s schemaCommand) printHtml(schema map[string]interface{}) {
|
||||
func (s schemaCommand) printHtml(schema map[string]any) {
|
||||
if temp, err := template.New("template").Parse(tmpl.HtmlFile); err != nil {
|
||||
utils.PrintError(err)
|
||||
return
|
||||
|
||||
@@ -45,7 +45,7 @@ func CheckChangeObject(changeObject string) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func PrintAnswer(data interface{}) {
|
||||
func PrintAnswer(data any) {
|
||||
encoder := json.NewEncoder(os.Stdout)
|
||||
encoder.SetEscapeHTML(false)
|
||||
encoder.SetIndent("", " ")
|
||||
@@ -59,7 +59,7 @@ func PrintError(err error) {
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
func ParseSetObject(argument string) interface{} {
|
||||
func ParseSetObject(argument string) any {
|
||||
tryParse := []byte(argument)
|
||||
if tryParse[0] == '"' && tryParse[len(tryParse)-1] == '"' {
|
||||
tryParse = tryParse[1 : len(tryParse)-1]
|
||||
@@ -70,12 +70,12 @@ func ParseSetObject(argument string) interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
mapStringInterface := make(map[string]interface{})
|
||||
mapStringInterface := make(map[string]any)
|
||||
if err := json.Unmarshal(tryParse, &mapStringInterface); err == nil {
|
||||
return mapStringInterface
|
||||
}
|
||||
|
||||
arrayOfObject := make([]interface{}, 0)
|
||||
arrayOfObject := make([]any, 0)
|
||||
if err := json.Unmarshal(tryParse, &arrayOfObject); err == nil {
|
||||
return arrayOfObject
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func CheckObject(jsonObject []byte, depth string) {
|
||||
if jsonString.Raw == "" {
|
||||
PrintError(errors.Errorf("path '%s' not found\n", depth))
|
||||
} else {
|
||||
var data interface{}
|
||||
var data any
|
||||
if err := json.Unmarshal([]byte(jsonString.Raw), &data); err != nil {
|
||||
PrintError(err)
|
||||
} else {
|
||||
|
||||
@@ -6,7 +6,8 @@ import (
|
||||
)
|
||||
|
||||
func CreateUpdateConfig(stringToChange string, configuration *cfg.Config) error {
|
||||
if answer, err := service.Config.CreateUpdateConfig(stringToChange, configuration); err != nil {
|
||||
answer, err := service.Config.CreateUpdateConfig(stringToChange, configuration)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if answer != nil {
|
||||
PrintAnswer(answer)
|
||||
|
||||
Reference in new issue
Block a user