mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-07 02:20:24 +08:00
字段中的blob和JSON类型映射为[]byte和dbs.JSON
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user