MCPcopy Create free account
hub / github.com/crawshaw/jsonfile / JSONFile

Struct JSONFile

jsonfile.go:19–25  ·  view source on GitHub ↗

JSONFile holds a Go value of type Data and persists it to a JSON file. Data is accessed and modified using the Read and Write methods. Create a JSONFile using the New or Load functions.

Source from the content-addressed store, hash-verified

17// Data is accessed and modified using the Read and Write methods.
18// Create a JSONFile using the New or Load functions.
19type JSONFile[Data any] struct {
20 path string
21
22 mu sync.RWMutex
23 bytes []byte
24 data *Data
25}
26
27// New creates a new empty JSONFile at the given path.
28func New[Data any](path string) (*JSONFile[Data], error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected