forked from electricdusk/rushlink
db: Refactor paste decoding into new func
This commit is contained in:
parent
76cf92e22d
commit
ba08aca622
@ -95,6 +95,10 @@ func GetPaste(tx *bolt.Tx, key string) (*Paste, error) {
|
|||||||
if storedBytes == nil {
|
if storedBytes == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
return decodePaste(storedBytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodePaste(storedBytes []byte) (*Paste, error) {
|
||||||
p := &Paste{}
|
p := &Paste{}
|
||||||
err := gobmarsh.Unmarshal(storedBytes, p)
|
err := gobmarsh.Unmarshal(storedBytes, p)
|
||||||
return p, err
|
return p, err
|
||||||
|
Loading…
Reference in New Issue
Block a user