Skip to content
Snippets Groups Projects
Commit 2bdabeb4 authored by Manish R Jain's avatar Manish R Jain
Browse files

Forgot to add mutation encoding, decoding code.

parent 8a0a2a9a
No related branches found
No related tags found
No related merge requests found
package worker
import (
"bytes"
"encoding/gob"
"github.com/dgraph-io/dgraph/x"
)
type Mutations struct {
Set []x.DirectedEdge
Del []x.DirectedEdge
}
func (m *Mutations) Encode() (data []byte, rerr error) {
var b bytes.Buffer
enc := gob.NewEncoder(&b)
rerr = enc.Encode(*m)
return b.Bytes(), rerr
}
func (m *Mutations) Decode(data []byte) error {
r := bytes.NewReader(data)
dec := gob.NewDecoder(r)
return dec.Decode(m)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment