fix: support list guest and knock

This commit is contained in:
Daniel Ding
2024-01-02 11:14:54 +08:00
parent 9a039a6d3c
commit 1af91f2f65
9 changed files with 131 additions and 34 deletions

View File

@@ -2,11 +2,12 @@ package api
import (
"fmt"
"github.com/ghodss/yaml"
"github.com/luscis/openlan/pkg/libol"
"os"
"strconv"
"text/template"
"github.com/ghodss/yaml"
"github.com/luscis/openlan/pkg/libol"
)
func OutJson(data interface{}) error {
@@ -61,6 +62,9 @@ func OutTable(data interface{}, tmpl string) error {
}
return fmt.Sprintf(format, value)
},
"ut": func(value int64) string {
return libol.UnixTime(value)
},
}
if tmpl, err := template.New("main").Funcs(funcMap).Parse(tmpl); err != nil {
return err