diff --git a/entry/entry.go b/entry/entry.go index c8c866f..1c31467 100644 --- a/entry/entry.go +++ b/entry/entry.go @@ -511,6 +511,14 @@ func (e *Entry) IsParent(b iface.IPFSLogEntry) bool { return false } +func (e *Entry) MarshalJSON() ([]byte, error) { + return json.Marshal(e) +} + +func (e *Entry) UnmarshalJSON(payload []byte) error { + return json.Unmarshal(payload, e) +} + // FindChildren finds an entry's children from an Array of entries. // // Returns entry's children as an Array up to the last know child. diff --git a/iface/iface.go b/iface/iface.go index 8cf2ab4..e918c23 100644 --- a/iface/iface.go +++ b/iface/iface.go @@ -2,6 +2,7 @@ package iface import ( "context" + "encoding/json" "time" "github.com/ipfs/go-cid" @@ -173,6 +174,10 @@ type IPFSLogEntry interface { Equals(b IPFSLogEntry) bool IsParent(b IPFSLogEntry) bool Defined() bool + + // marshaler + json.Marshaler + json.Unmarshaler } type IPFSLogLamportClock interface {