MCPcopy Create free account
hub / github.com/astercloud/aster / Set

Method Set

pkg/store/json.go:393–403  ·  view source on GitHub ↗

Set 设置资源

(ctx context.Context, collection, key string, value any)

Source from the content-addressed store, hash-verified

391
392// Set 设置资源
393func (js *JSONStore) Set(ctx context.Context, collection, key string, value any) error {
394 js.mu.Lock()
395 defer js.mu.Unlock()
396
397 if err := js.ensureCollectionDir(collection); err != nil {
398 return err
399 }
400
401 path := filepath.Join(js.collectionDir(collection), key+".json")
402 return js.saveJSON(path, value)
403}
404
405// Delete 删除资源
406func (js *JSONStore) Delete(ctx context.Context, collection, key string) error {

Callers

nothing calls this directly

Calls 4

ensureCollectionDirMethod · 0.95
collectionDirMethod · 0.95
saveJSONMethod · 0.95
JoinMethod · 0.45

Tested by

no test coverage detected