db: Refactor paste decoding into new func

This commit is contained in:
Daan Sprenkels 2019-12-10 12:24:58 +01:00
parent 76cf92e22d
commit ba08aca622

View File

@ -95,6 +95,10 @@ func GetPaste(tx *bolt.Tx, key string) (*Paste, error) {
if storedBytes == nil {
return nil, nil
}
return decodePaste(storedBytes)
}
func decodePaste(storedBytes []byte) (*Paste, error) {
p := &Paste{}
err := gobmarsh.Unmarshal(storedBytes, p)
return p, err