mirror of
https://github.com/number571/go-peer.git
synced 2026-09-13 18:45:44 +05:00
19 lines
369 B
Go
19 lines
369 B
Go
package encoding
|
|
|
|
import (
|
|
"github.com/number571/go-peer/pkg/utils"
|
|
yaml "gopkg.in/yaml.v2"
|
|
)
|
|
|
|
func SerializeYAML(pData interface{}) []byte {
|
|
res, _ := yaml.Marshal(pData)
|
|
return res
|
|
}
|
|
|
|
func DeserializeYAML(pData []byte, pRes interface{}) error {
|
|
if err := yaml.Unmarshal(pData, pRes); err != nil {
|
|
return utils.MergeErrors(ErrDeserialize, err)
|
|
}
|
|
return nil
|
|
}
|