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

Method GetField

docstore/driver/document.go:63–76  ·  view source on GitHub ↗

GetField returns the value of the named document field.

(field string)

Source from the content-addressed store, hash-verified

61
62// GetField returns the value of the named document field.
63func (d Document) GetField(field string) (any, error) {
64 if d.m != nil {
65 x, ok := d.m[field]
66 if !ok {
67 return nil, gcerr.Newf(gcerr.NotFound, nil, "field %q not found in map", field)
68 }
69 return x, nil
70 }
71 v, err := d.structField(field)
72 if err != nil {
73 return nil, err
74 }
75 return v.Interface(), nil
76}
77
78// getDocument gets the value of the given field path, which must be a document.
79// If create is true, it creates intermediate documents as needed.

Callers 15

toDriverActionMethod · 0.95
InMemorySortFallbackFunction · 0.95
getDocumentMethod · 0.95
TestGetFieldFunction · 0.95
checkNoRevisionFieldFunction · 0.95
checkHasRevisionFieldFunction · 0.95
KeyMethod · 0.80
KeyMethod · 0.80
checkRevisionMethod · 0.80
copyTopLevelFunction · 0.80
encodeDocKeyFieldsFunction · 0.80
KeyMethod · 0.80

Calls 2

structFieldMethod · 0.95
NewfFunction · 0.92

Tested by 3

TestGetFieldFunction · 0.76
KeyMethod · 0.64
TestLowercaseFieldsFunction · 0.64