initial commit

This commit is contained in:
ston1th 2023-03-14 01:43:04 +01:00
commit 60fb40d61a
34 changed files with 2571 additions and 0 deletions

25
pkg/store/gob.go Normal file
View file

@ -0,0 +1,25 @@
// Copyright (C) 2022 Marius Schellenberger
package store
import (
"bytes"
"encoding/gob"
)
type gobMarshaler struct{}
func NewGOB() Marshaler {
return gobMarshaler{}
}
func (gobMarshaler) Marshal(v interface{}) (b []byte, err error) {
buf := new(bytes.Buffer)
err = gob.NewEncoder(buf).Encode(v)
b = buf.Bytes()
return
}
func (gobMarshaler) Unmarshal(data []byte, v interface{}) error {
return gob.NewDecoder(bytes.NewBuffer(data)).Decode(v)
}