1 Star 0 Fork 0

linngc / central-mirror

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
embedfs_remove.go 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
linngc 提交于 2024-04-01 16:44 . update:提取speedsdk扩张到工具包
// Package embedfs
// @Link https://gitee.com/linngc/central-mirror
// @Copyright Copyright (c) 2024 central-mirror CLI
// @Author linngc
// @License
package embedfs
import (
"context"
"os"
)
// RemoveByObject 删除对象
// @param moduleName 参数是 文件模块名称(请求的文件全路径名称)
func (c *EmbedFs) RemoveByObject(ctx context.Context, moduleName string) error {
go func(c *EmbedFs) {
//删除文件夹时,要指定绝对路径(包含指定的缓存路径)
os.Remove(c.getAbsoluteLocation(moduleName))
}(c)
return nil
}
// RemoveByObjectList 删除对象集合
// @param moduleName 参数是 文件模块名称(请求的文件全路径名称)
func (c *EmbedFs) RemoveByObjectList(ctx context.Context, moduleNames []string) error {
for _, moduleName := range moduleNames {
go func(c *EmbedFs, moduleNames []string) {
//删除文件夹时,要指定绝对路径(包含指定的缓存路径)
os.RemoveAll(c.getAbsoluteLocation(moduleName))
}(c, moduleNames)
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/linngc/central-mirror.git
git@gitee.com:linngc/central-mirror.git
linngc
central-mirror
central-mirror
a6b6bab2d6e5

搜索帮助

344bd9b3 5694891 D2dac590 5694891