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

19 lines
503 B
Go
Raw Normal View History

2020-08-30 16:12:00 +08:00
package models
2021-08-18 16:19:16 +08:00
import (
"encoding/json"
2021-09-08 19:34:31 +08:00
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
2021-08-18 16:19:16 +08:00
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
)
2021-09-08 19:34:31 +08:00
func (this *NodeIPAddress) DecodeConnectivity() *nodeconfigs.Connectivity {
var connectivity = &nodeconfigs.Connectivity{}
if len(this.Connectivity) > 0 {
err := json.Unmarshal([]byte(this.Connectivity), connectivity)
if err != nil {
remotelogs.Error("NodeIPAddress.DecodeConnectivity", "decode failed: "+err.Error())
}
}
return connectivity
}