mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-08 17:00:26 +08:00
feat: 机器列表新增运行状态 & refactor: 登录账号信息存储与context
This commit is contained in:
@@ -13,6 +13,11 @@ func ToMap(jsonStr string) map[string]any {
|
||||
return ToMapByBytes([]byte(jsonStr))
|
||||
}
|
||||
|
||||
// json字符串转结构体
|
||||
func To[T any](jsonStr string, res T) (T, error) {
|
||||
return res, json.Unmarshal([]byte(jsonStr), &res)
|
||||
}
|
||||
|
||||
// json字节数组转map
|
||||
func ToMapByBytes(bytes []byte) map[string]any {
|
||||
var res map[string]any
|
||||
|
||||
Reference in New Issue
Block a user