Set 设置资源
(ctx context.Context, collection, key string, value any)
| 391 | |
| 392 | // Set 设置资源 |
| 393 | func (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 删除资源 |
| 406 | func (js *JSONStore) Delete(ctx context.Context, collection, key string) error { |
nothing calls this directly
no test coverage detected