mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 12:37:16 +00:00
331dcd45eb
* squash * add --database flag to integration * clean * split to 2 buckets * split to 2 buckets * split to 2 buckets * split to 2 buckets * split to 2 buckets * save progress * save progress * improve test * improve test * save progress * change app logic * change app logic * return err from rawdb package * don't clean automatically * don't clean automatically * clean * clean * clean * don't rely on `make clean` * improve cbor code * clean * clean * clean * fix tests * rebase master * stop on error: headers stage * make TxDb walk and multiwalk safe * Fix panics Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
34 lines
525 B
Go
34 lines
525 B
Go
package cbor
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
func Marshal(dst io.Writer, v interface{}) error {
|
|
e := Encoder(dst)
|
|
err := e.Encode(v)
|
|
returnEncoderToPool(e)
|
|
return err
|
|
}
|
|
|
|
func Unmarshal(dst interface{}, data io.Reader) error {
|
|
d := Decoder(data)
|
|
err := d.Decode(dst)
|
|
returnDecoderToPool(d)
|
|
return err
|
|
}
|
|
|
|
func MustMarshal(dst io.Writer, v interface{}) {
|
|
err := Marshal(dst, v)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func MustUnmarshal(dst interface{}, data io.Reader) {
|
|
err := Unmarshal(dst, data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|