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

Method Delete

pkg/store/json.go:406–419  ·  view source on GitHub ↗

Delete 删除资源

(ctx context.Context, collection, key string)

Source from the content-addressed store, hash-verified

404
405// Delete 删除资源
406func (js *JSONStore) Delete(ctx context.Context, collection, key string) error {
407 js.mu.Lock()
408 defer js.mu.Unlock()
409
410 path := filepath.Join(js.collectionDir(collection), key+".json")
411 if err := os.Remove(path); err != nil {
412 if os.IsNotExist(err) {
413 return ErrNotFound
414 }
415 return fmt.Errorf("remove file: %w", err)
416 }
417
418 return nil
419}
420
421// List 列出资源
422func (js *JSONStore) List(ctx context.Context, collection string) ([]any, error) {

Callers

nothing calls this directly

Calls 3

collectionDirMethod · 0.95
JoinMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected