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

Method Set

docstore/driver/document.go:129–135  ·  view source on GitHub ↗

Set sets the value of the field path in the document. This creates sub-maps as necessary, if possible.

(fp []string, val any)

Source from the content-addressed store, hash-verified

127// Set sets the value of the field path in the document.
128// This creates sub-maps as necessary, if possible.
129func (d Document) Set(fp []string, val any) error {
130 d2, err := d.getDocument(fp[:len(fp)-1], true)
131 if err != nil {
132 return err
133 }
134 return d2.SetField(fp[len(fp)-1], val)
135}
136
137// SetField sets the field to value in the document.
138func (d Document) SetField(field string, value any) error {

Callers 9

TestSetFunction · 0.95
newUpdateMethod · 0.45
setFieldsFunction · 0.45
SetFieldMethod · 0.45
decodeFunction · 0.45
prepareLengthFunction · 0.45
decodeMapFunction · 0.45
fieldByIndexCreateFunction · 0.45
AsFuncFunction · 0.45

Calls 2

getDocumentMethod · 0.95
SetFieldMethod · 0.80

Tested by 2

TestSetFunction · 0.76
setFieldsFunction · 0.36