mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 07:56:50 +08:00
logic edit ,bug fix
This commit is contained in:
@@ -83,3 +83,11 @@ func JsonStrToStruct[T any](str string) T {
|
||||
json.Unmarshal([]byte(str), &data)
|
||||
return data
|
||||
}
|
||||
|
||||
func StructToJsonStr[T any](data T) string {
|
||||
jsonStr, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(jsonStr)
|
||||
}
|
||||
|
Reference in New Issue
Block a user