MCPcopy Create free account
hub / github.com/google/go-cloud / Get

Method Get

docstore/driver/document.go:104–110  ·  view source on GitHub ↗

Get returns the value of the given field path in the document.

(fp []string)

Source from the content-addressed store, hash-verified

102
103// Get returns the value of the given field path in the document.
104func (d Document) Get(fp []string) (any, error) {
105 d2, err := d.getDocument(fp[:len(fp)-1], false)
106 if err != nil {
107 return nil, err
108 }
109 return d2.GetField(fp[len(fp)-1])
110}
111
112func (d Document) structField(name string) (reflect.Value, error) {
113 // We do case-insensitive match here to cover the MongoDB's lowercaseFields

Callers 15

TestGetFunction · 0.95
TestSetFunction · 0.95
TestQueryNestedFunction · 0.45
OpenCollectionURLMethod · 0.45
processURLMethod · 0.45
TestQueryErrorsFunction · 0.45
evaluateFilterFunction · 0.45
OpenCollectionURLMethod · 0.45
DecodeMethod · 0.45
TestTagErrorsFunction · 0.45
ParseStandardTagFunction · 0.45
benchmarkSingleActionGetFunction · 0.45

Calls 2

getDocumentMethod · 0.95
GetFieldMethod · 0.80

Tested by 7

TestGetFunction · 0.76
TestSetFunction · 0.76
TestQueryNestedFunction · 0.36
TestQueryErrorsFunction · 0.36
DecodeMethod · 0.36
TestTagErrorsFunction · 0.36
TestLowercaseFieldsFunction · 0.36