feat: 机器列表新增运行状态 & refactor: 登录账号信息存储与context

This commit is contained in:
meilin.huang
2023-11-07 21:05:21 +08:00
parent d9adf0fd25
commit eddda41291
74 changed files with 915 additions and 652 deletions

View File

@@ -0,0 +1,26 @@
package stringx
import (
"fmt"
"mayfly-go/pkg/utils/collx"
"strings"
"testing"
)
func TestTemplateParse(t *testing.T) {
tmpl := `
{{if gt .cpu 10*5}}
当前服务器[{{.asset.host}}]cpu使用率为{{.cpu}}
{{end}}
`
vars := collx.M{
"cpu": 60,
"asset": collx.M{
"host": "localhost:121",
},
}
res, _ := TemplateParse(tmpl, vars)
res2 := strings.TrimSpace(res)
fmt.Println(res2)
}