MCPcopy Index your code
hub / github.com/crawshaw/jsonfile / Read

Method Read

jsonfile.go:64–68  ·  view source on GitHub ↗

Read calls fn with the current copy of the data.

(fn func(data *Data))

Source from the content-addressed store, hash-verified

62
63// Read calls fn with the current copy of the data.
64func (p *JSONFile[Data]) Read(fn func(data *Data)) {
65 p.mu.RLock()
66 defer p.mu.RUnlock()
67 fn(p.data)
68}
69
70// Write calls fn with a copy of the data, then writes the changes to the file.
71// If fn returns an error, Write does not change the file and returns the error.

Callers 4

TestBasicFunction · 0.80
TestFileErrorFunction · 0.80
TestNoAliasFunction · 0.80

Calls

no outgoing calls

Tested by 4

TestBasicFunction · 0.64
TestFileErrorFunction · 0.64
TestNoAliasFunction · 0.64