字段中的blob和JSON类型映射为[]byte和dbs.JSON

This commit is contained in:
GoEdgeLab
2022-03-21 21:39:36 +08:00
parent a2cf2e5b03
commit 31599bee13
105 changed files with 1537 additions and 1156 deletions

View File

@@ -9,18 +9,18 @@ import (
// DecodeAddr 解析地址
func (this *Origin) DecodeAddr() (*serverconfigs.NetworkAddressConfig, error) {
if len(this.Addr) == 0 || this.Addr == "null" {
if len(this.Addr) == 0 {
return nil, errors.New("addr is empty")
}
addr := &serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(this.Addr), addr)
err := json.Unmarshal(this.Addr, addr)
return addr, err
}
func (this *Origin) DecodeDomains() []string {
var result = []string{}
if len(this.Domains) > 0 {
err := json.Unmarshal([]byte(this.Domains), &result)
err := json.Unmarshal(this.Domains, &result)
if err != nil {
remotelogs.Error("Origin.DecodeDomains", err.Error())
}