Files
EdgeAPI/internal/db/models/report_node_model_ext.go

29 lines
611 B
Go
Raw Permalink Normal View History

package models
2021-09-08 19:34:31 +08:00
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
)
func (this *ReportNode) DecodeAllowIPs() []string {
var result = []string{}
if len(this.AllowIPs) > 0 {
2022-03-22 19:30:30 +08:00
err := json.Unmarshal(this.AllowIPs, &result)
2021-09-08 19:34:31 +08:00
if err != nil {
remotelogs.Error("ReportNode.DecodeGroupIds", err.Error())
}
}
return result
}
func (this *ReportNode) DecodeGroupIds() []int64 {
var result = []int64{}
if len(this.GroupIds) > 0 {
2022-03-22 19:30:30 +08:00
err := json.Unmarshal(this.GroupIds, &result)
2021-09-08 19:34:31 +08:00
if err != nil {
remotelogs.Error("ReportNode.DecodeGroupIds", err.Error())
}
}
return result
}