MCPcopy Index your code
hub / github.com/redspread/spread / getObjectFromDoc

Function getObjectFromDoc

pkg/data/document.go:67–78  ·  view source on GitHub ↗
(doc *pb.Document)

Source from the content-addressed store, hash-verified

65}
66
67func getObjectFromDoc(doc *pb.Document) (*pb.Object, error) {
68 root := doc.GetRoot()
69 if root == nil {
70 return nil, fmt.Errorf("document '%s' does not have a root", doc.Name)
71 }
72
73 obj := root.GetObject()
74 if obj == nil {
75 return nil, fmt.Errorf("root field of document '%s' does not have an object as it's value", doc.Name)
76 }
77 return obj, nil
78}

Callers 1

MapFromDocumentFunction · 0.85

Calls 2

GetRootMethod · 0.80
GetObjectMethod · 0.80

Tested by

no test coverage detected