rss and rss item and encode
Former-commit-id: 333b5635cc0eb22964403cc78f660e02a830f077
This commit is contained in:
20
config/encode.go
Normal file
20
config/encode.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
)
|
||||
|
||||
func Encode(v interface{}) ([]byte, error) {
|
||||
buff := bytes.NewBuffer(nil)
|
||||
enc := gob.NewEncoder(buff)
|
||||
err := enc.Encode(v)
|
||||
return buff.Bytes(), err
|
||||
}
|
||||
|
||||
func Decode(b []byte, v interface{}) error {
|
||||
buff := bytes.NewBuffer(b)
|
||||
enc := gob.NewDecoder(buff)
|
||||
err := enc.Decode(v)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user