pkg

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api interface {
	Sign() error

	Space() (Space, error)

	Login(name, password string) error

	Find(id, name string) (File, error)

	FindDir(id, name string) (File, error)

	FindFile(id, name string) (File, error)

	ListFile(id string) ([]File, error)

	Mkdir(parentId, path string, parents bool) error

	Mkdirs(parentId string, path ...string) (map[string]interface{}, error)

	Copy(taget string, src ...File) error

	Move(taget string, src ...File) error

	Delete(src ...File) error

	Rename(file File, newName string) error

	Download(file File, start int64) (*http.Response, error)

	ReadWriter
}

type App

type App interface {
	Uploader() ReadWriter

	Login(name, password string) error

	Sign() error

	Space() (Space, error)

	Stat(path string) (File, error)

	List(file File) ([]File, error)

	ListBy(name string) ([]File, error)

	Mkdir(path string, parents bool) error

	Mkdirs(path ...string) error

	Copy(target string, from ...string) error

	Move(target string, from ...string) error

	Remove(paths ...string) error

	Download(local string, paths ...string) error

	DownloadFile(local string, file File) error

	Upload(cloud string, locals ...string) error
}

type Drive added in v0.6.0

type Drive interface {
	fs.StatFS
	fs.ReadDirFS
	Space() (Space, error)
	Mkdir(name string) error
	Delete(name ...string) error
	Login(username, password string) error
	Copy(target string, source ...string) error
	Move(target string, source ...string) error
	Upload(cloud string, locals ...string) error
	UploadFrom(file Upload) error
	Download(local string, cloud ...string) error
	Share(prifix, cloud string) (func(http.ResponseWriter, *http.Request), error)
}

type DriveApi added in v0.6.0

type DriveApi interface {
	PwdLogin(username, password string) error

	// get upload
	Uploader() ReadWriter

	// get download link
	Download(file File, start int64) (*http.Response, error)

	// sign for space
	Sign() error

	// get space info
	Space() (Space, error)

	// searce file by type
	Search(parent File, fileType FileType, name string) ([]File, error)

	// list file by type
	List(parent File, fileType FileType) ([]File, error)

	// mkdir
	Mkdir(parent File, name string) (File, error)

	// rename file
	Rename(target File, name string) error

	// move file
	Move(target File, source ...File) error

	// copy file
	Copy(target File, source ...File) error

	// delete file
	Delete(file ...File) error
}

type File

type File interface {
	Id() string
	PId() string
	os.FileInfo
}

type FileExt

type FileExt struct {
	FileCount   int64
	CreateTime  time.Time
	DownloadUrl string
}

type FileType added in v0.6.0

type FileType uint16
const (
	ALL FileType = iota
	FILE
	DIR
)

type ReadWriter added in v0.6.0

type ReadWriter interface {
	// upload
	Write(info Upload) error
}

type Space

type Space struct {
	Available uint64 `json:"available,omitempty"`
	Capacity  uint64 `json:"capacity,omitempty"`
}

type Upload added in v0.6.0

type Upload interface {
	ParentId() string
	Name() string
	Size() int64
	SliceNum() int
	FileMD5() string
	SliceMD5() string
	Overwrite() bool
	Part(int64) UploadPart
	LazyCheck() bool
}

type UploadFile

type UploadFile interface {
	Prepare(init func())
	ParentId() string
	Name() string
	Size() int64
	SliceNum() int
	FileMD5() string
	SliceMD5() string
	IsExists() bool
	Type() string
	IsComplete() bool
	UploadId() string
	Overwrite() bool
	SetExists(exists bool)
	SetUploadId(uploadId string)
}

type UploadPart

type UploadPart interface {
	Num() int
	Name() string
	Data() io.Reader
}

type Uploader1 added in v0.6.0

type Uploader1 interface {
	Upload(file UploadFile, part UploadPart) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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