storage

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnStr

func BuildConnStr(storage_name, bucket_name, work_dir, endpoint, app_key, secret_key string) string

BuildConnStr , 构建存储链接串 参数:

storage_name : 存储类型
bucket_name :  存储桶名称
work_dir :  工作目录,存在的话左侧加"/"
endpoint :  端点
app_key :  app_key
secret_key :  secret_key

返回值:

存储链接串

func IsDir

func IsDir(fileObject *types.Object) bool

Types

type FileSys

type FileSys struct {

	//链接串
	ConnStr string

	//地址访问前缀
	AccessPrefix string
	// contains filtered or unexported fields
}

func CreateFileSys

func CreateFileSys(connStr string, logger ...*logr.Logger) (*FileSys, error)

CreateFileSys , 创建文件操作类 参数:

connStr : 存储链接串
logger : 日志类

返回值:

FileSys:文件操作类指针
error: 异常

func (*FileSys) Copy

func (obj *FileSys) Copy(srcPath, desPath string) (err error)

Copy , 复制文件 参数:

srcPath : 源文件路径
desPath : 目标文件路径

返回值:

error: 异常

func (*FileSys) CopyDir

func (obj *FileSys) CopyDir(srcDir, dstPath string) (err error)

CopyDir , 复制目录 参数:

srcDir : 源目录
dstPath: 目标目录

返回值:

error: 异常

func (*FileSys) CreateDir

func (obj *FileSys) CreateDir(path string) (err error)

CreateDir , 创建目录 参数:

path : 目录路径

返回值:

error: 异常

func (*FileSys) Delete

func (obj *FileSys) Delete(path string) (err error)

Delete , 删除文件 参数:

path : 文件路径

返回值:

error: 异常

func (*FileSys) DirAllFileName

func (obj *FileSys) DirAllFileName(path string) (names []string, err error)

func (*FileSys) FileExist

func (obj *FileSys) FileExist(path string) (exist bool)

FileExist , 判断文件是否存在 参数:

path : 文件路径

返回值:

exist: true 存在,不存在

func (*FileSys) GetFileInfo

func (obj *FileSys) GetFileInfo(path string) (res *types.Object)

GetFileInfo , 获取文件信息 参数:

path : 文件路径

返回值:

res: 文件信息

func (*FileSys) ListAll

func (obj *FileSys) ListAll(path string) (oi *types.ObjectIterator, err error)

ListAll , 目录下所有文件对象,含子目录 参数:

path : 目录路径

返回值:

oi: 文件对象
error: 异常

func (*FileSys) Read

func (obj *FileSys) Read(path string, w io.Writer, pairs ...types.Pair) (n int64, err error)

func (*FileSys) Relative

func (obj *FileSys) Relative(basepath, targpath string) (string, error)

func (*FileSys) Write

func (obj *FileSys) Write(path string, r io.Reader, size int64, pairs ...types.Pair) (int64, error)

Write , 写入文件 参数:

path : 路径
r : 读取器
r : 读取长度

返回值:

int64: 实际写入长度
error: 异常

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL