serialize data

This commit is contained in:
Alexander Wang 2024-11-07 15:41:57 -07:00
parent 426c3e9549
commit f5894e22d3
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927

View file

@ -14,6 +14,7 @@ type SerializedGraph struct {
Edges []SerializedEdge `json:"edges"`
Objects []SerializedObject `json:"objects"`
RootLevel int `json:"rootLevel"`
Data map[string]interface{} `json:"data,omitempty"`
}
type SerializedObject map[string]interface{}
@ -27,6 +28,7 @@ func DeserializeGraph(bytes []byte, g *Graph) error {
return err
}
g.Data = sg.Data
var root Object
Convert(sg.Root, &root)
g.Root = &root
@ -95,6 +97,7 @@ func SerializeGraph(g *Graph) ([]byte, error) {
}
sg.Root = root
sg.RootLevel = g.RootLevel
sg.Data = g.Data
var sobjects []SerializedObject
for _, o := range g.Objects {