Saving place.Units as byte array instead of trying any encoding
This commit is contained in:
parent
a14c77aac8
commit
8f025c2e36
|
@ -26,11 +26,6 @@ func gobDecodeInt64(i *int64, data []byte) error {
|
|||
return g.Decode(i)
|
||||
}
|
||||
|
||||
func gobDecodeString(s *string, data []byte) error {
|
||||
g := gob.NewDecoder(bytes.NewReader(data))
|
||||
return g.Decode(s)
|
||||
}
|
||||
|
||||
func gobDecodeBool(b *bool, data []byte) error {
|
||||
g := gob.NewDecoder(bytes.NewReader(data))
|
||||
return g.Decode(b)
|
||||
|
@ -647,9 +642,7 @@ func unmapPlaceProperties(mm map[string][]byte, p *Place) error {
|
|||
}
|
||||
}
|
||||
if raw, ok := mm["units"]; ok {
|
||||
if err = gobDecodeString(&p.Units, raw); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Units = string(raw)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -679,9 +679,7 @@ func mapPlaceProperties(mm map[string][]byte, p Place) (hasData bool, err error)
|
|||
hasData = true
|
||||
}
|
||||
if len(p.Units) > 0 {
|
||||
if mm["units"], err = gobEncodeBytes([]byte(p.Units)); err != nil {
|
||||
return
|
||||
}
|
||||
mm["units"] = []byte(p.Units)
|
||||
hasData = true
|
||||
}
|
||||
return
|
||||
|
|
Reference in a new issue