Enable data docs to self encode to JSON
This commit is contained in:
parent
997633eaf4
commit
969179660b
1 changed files with 6 additions and 0 deletions
|
@ -20,6 +20,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
"github.com/abcum/surreal/util/deep"
|
||||
"github.com/abcum/surreal/util/pack"
|
||||
)
|
||||
|
@ -71,6 +73,10 @@ func (d *Doc) Decode(src []byte) *Doc {
|
|||
return d
|
||||
}
|
||||
|
||||
func (d *Doc) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.Data())
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
func (d *Doc) path(path ...string) (paths []string) {
|
||||
|
|
Loading…
Reference in a new issue