filesystem

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFileNum = 1000

Variables

This section is empty.

Functions

func Initialize

func Initialize()

func NewDriver

func NewDriver(disk string) (filesystem.Driver, error)

Types

type Cos

type Cos struct {
	// contains filtered or unexported fields
}

func NewCos

func NewCos(ctx context.Context, disk string) (*Cos, error)

func (*Cos) AllDirectories

func (r *Cos) AllDirectories(path string) ([]string, error)

func (*Cos) AllFiles

func (r *Cos) AllFiles(path string) ([]string, error)

func (*Cos) Copy

func (r *Cos) Copy(originFile, targetFile string) error

func (*Cos) Delete

func (r *Cos) Delete(files ...string) error

func (*Cos) DeleteDirectory

func (r *Cos) DeleteDirectory(directory string) error

func (*Cos) Directories

func (r *Cos) Directories(path string) ([]string, error)

func (*Cos) Exists

func (r *Cos) Exists(file string) bool

func (*Cos) Files

func (r *Cos) Files(path string) ([]string, error)

func (*Cos) Get

func (r *Cos) Get(file string) (string, error)

func (*Cos) MakeDirectory

func (r *Cos) MakeDirectory(directory string) error

func (*Cos) Missing

func (r *Cos) Missing(file string) bool

func (*Cos) Move

func (r *Cos) Move(oldFile, newFile string) error

func (*Cos) Path

func (r *Cos) Path(file string) string

func (*Cos) Put

func (r *Cos) Put(file string, content string) error

func (*Cos) PutFile

func (r *Cos) PutFile(filePath string, source filesystem.File) (string, error)

func (*Cos) PutFileAs

func (r *Cos) PutFileAs(filePath string, source filesystem.File, name string) (string, error)

func (*Cos) Size

func (r *Cos) Size(file string) (int64, error)

func (*Cos) TemporaryUrl

func (r *Cos) TemporaryUrl(file string, time time.Time) (string, error)

func (*Cos) Url

func (r *Cos) Url(file string) string

func (*Cos) WithContext

func (r *Cos) WithContext(ctx context.Context) filesystem.Driver

type Driver

type Driver string
const (
	DriverLocal  Driver = "local"
	DriverS3     Driver = "s3"
	DriverOss    Driver = "oss"
	DriverCos    Driver = "cos"
	DriverMinio  Driver = "minio"
	DriverCustom Driver = "custom"
)

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(file string) (*File, error)

func NewFileFromRequest

func NewFileFromRequest(fileHeader *multipart.FileHeader) (*File, error)

func (*File) Disk

func (f *File) Disk(disk string) filesystem.File

func (*File) Extension

func (f *File) Extension() (string, error)

func (*File) File

func (f *File) File() string

func (*File) GetClientOriginalExtension

func (f *File) GetClientOriginalExtension() string

func (*File) GetClientOriginalName

func (f *File) GetClientOriginalName() string

func (*File) HashName

func (f *File) HashName(path ...string) string

func (*File) Store

func (f *File) Store(path string) (string, error)

func (*File) StoreAs

func (f *File) StoreAs(path string, name string) (string, error)

type Local

type Local struct {
	// contains filtered or unexported fields
}

func NewLocal

func NewLocal(disk string) (*Local, error)

func (*Local) AllDirectories

func (r *Local) AllDirectories(path string) ([]string, error)

func (*Local) AllFiles

func (r *Local) AllFiles(path string) ([]string, error)

func (*Local) Copy

func (r *Local) Copy(originFile, targetFile string) error

func (*Local) Delete

func (r *Local) Delete(files ...string) error

func (*Local) DeleteDirectory

func (r *Local) DeleteDirectory(directory string) error

func (*Local) Directories

func (r *Local) Directories(path string) ([]string, error)

func (*Local) Exists

func (r *Local) Exists(file string) bool

func (*Local) Files

func (r *Local) Files(path string) ([]string, error)

func (*Local) Get

func (r *Local) Get(file string) (string, error)

func (*Local) MakeDirectory

func (r *Local) MakeDirectory(directory string) error

func (*Local) Missing

func (r *Local) Missing(file string) bool

func (*Local) Move

func (r *Local) Move(oldFile, newFile string) error

func (*Local) Path

func (r *Local) Path(file string) string

func (*Local) Put

func (r *Local) Put(file, content string) error

func (*Local) PutFile

func (r *Local) PutFile(filePath string, source filesystem.File) (string, error)

func (*Local) PutFileAs

func (r *Local) PutFileAs(filePath string, source filesystem.File, name string) (string, error)

func (*Local) Size

func (r *Local) Size(file string) (int64, error)

func (*Local) TemporaryUrl

func (r *Local) TemporaryUrl(file string, time time.Time) (string, error)

func (*Local) Url

func (r *Local) Url(file string) string

func (*Local) WithContext

func (r *Local) WithContext(ctx context.Context) filesystem.Driver

type Minio

type Minio struct {
	// contains filtered or unexported fields
}

func NewMinio

func NewMinio(ctx context.Context, disk string) (*Minio, error)

func (*Minio) AllDirectories

func (r *Minio) AllDirectories(path string) ([]string, error)

func (*Minio) AllFiles

func (r *Minio) AllFiles(path string) ([]string, error)

func (*Minio) Copy

func (r *Minio) Copy(originFile, targetFile string) error

func (*Minio) Delete

func (r *Minio) Delete(files ...string) error

func (*Minio) DeleteDirectory

func (r *Minio) DeleteDirectory(directory string) error

func (*Minio) Directories

func (r *Minio) Directories(path string) ([]string, error)

func (*Minio) Exists

func (r *Minio) Exists(file string) bool

func (*Minio) Files

func (r *Minio) Files(path string) ([]string, error)

func (*Minio) Get

func (r *Minio) Get(file string) (string, error)

func (*Minio) MakeDirectory

func (r *Minio) MakeDirectory(directory string) error

func (*Minio) Missing

func (r *Minio) Missing(file string) bool

func (*Minio) Move

func (r *Minio) Move(oldFile, newFile string) error

func (*Minio) Path

func (r *Minio) Path(file string) string

func (*Minio) Put

func (r *Minio) Put(file string, content string) error

func (*Minio) PutFile

func (r *Minio) PutFile(filePath string, source filesystem.File) (string, error)

func (*Minio) PutFileAs

func (r *Minio) PutFileAs(filePath string, source filesystem.File, name string) (string, error)

func (*Minio) Size

func (r *Minio) Size(file string) (int64, error)

func (*Minio) TemporaryUrl

func (r *Minio) TemporaryUrl(file string, time time.Time) (string, error)

func (*Minio) Url

func (r *Minio) Url(file string) string

func (*Minio) WithContext

func (r *Minio) WithContext(ctx context.Context) filesystem.Driver

type Oss

type Oss struct {
	// contains filtered or unexported fields
}

func NewOss

func NewOss(ctx context.Context, disk string) (*Oss, error)

func (*Oss) AllDirectories

func (r *Oss) AllDirectories(path string) ([]string, error)

func (*Oss) AllFiles

func (r *Oss) AllFiles(path string) ([]string, error)

func (*Oss) Copy

func (r *Oss) Copy(originFile, targetFile string) error

func (*Oss) Delete

func (r *Oss) Delete(files ...string) error

func (*Oss) DeleteDirectory

func (r *Oss) DeleteDirectory(directory string) error

func (*Oss) Directories

func (r *Oss) Directories(path string) ([]string, error)

func (*Oss) Exists

func (r *Oss) Exists(file string) bool

func (*Oss) Files

func (r *Oss) Files(path string) ([]string, error)

func (*Oss) Get

func (r *Oss) Get(file string) (string, error)

func (*Oss) MakeDirectory

func (r *Oss) MakeDirectory(directory string) error

func (*Oss) Missing

func (r *Oss) Missing(file string) bool

func (*Oss) Move

func (r *Oss) Move(oldFile, newFile string) error

func (*Oss) Path

func (r *Oss) Path(file string) string

func (*Oss) Put

func (r *Oss) Put(file string, content string) error

func (*Oss) PutFile

func (r *Oss) PutFile(filePath string, source filesystem.File) (string, error)

func (*Oss) PutFileAs

func (r *Oss) PutFileAs(filePath string, source filesystem.File, name string) (string, error)

func (*Oss) Size

func (r *Oss) Size(file string) (int64, error)

func (*Oss) TemporaryUrl

func (r *Oss) TemporaryUrl(file string, time time.Time) (string, error)

func (*Oss) Url

func (r *Oss) Url(file string) string

func (*Oss) WithContext

func (r *Oss) WithContext(ctx context.Context) filesystem.Driver

type S3

type S3 struct {
	// contains filtered or unexported fields
}

func NewS3

func NewS3(ctx context.Context, disk string) (*S3, error)

func (*S3) AllDirectories

func (r *S3) AllDirectories(path string) ([]string, error)

func (*S3) AllFiles

func (r *S3) AllFiles(path string) ([]string, error)

func (*S3) Copy

func (r *S3) Copy(originFile, targetFile string) error

func (*S3) Delete

func (r *S3) Delete(files ...string) error

func (*S3) DeleteDirectory

func (r *S3) DeleteDirectory(directory string) error

func (*S3) Directories

func (r *S3) Directories(path string) ([]string, error)

func (*S3) Exists

func (r *S3) Exists(file string) bool

func (*S3) Files

func (r *S3) Files(path string) ([]string, error)

func (*S3) Get

func (r *S3) Get(file string) (string, error)

func (*S3) MakeDirectory

func (r *S3) MakeDirectory(directory string) error

func (*S3) Missing

func (r *S3) Missing(file string) bool

func (*S3) Move

func (r *S3) Move(oldFile, newFile string) error

func (*S3) Path

func (r *S3) Path(file string) string

func (*S3) Put

func (r *S3) Put(file string, content string) error

func (*S3) PutFile

func (r *S3) PutFile(filePath string, source filesystem.File) (string, error)

func (*S3) PutFileAs

func (r *S3) PutFileAs(filePath string, source filesystem.File, name string) (string, error)

func (*S3) Size

func (r *S3) Size(file string) (int64, error)

func (*S3) TemporaryUrl

func (r *S3) TemporaryUrl(file string, time time.Time) (string, error)

func (*S3) Url

func (r *S3) Url(file string) string

func (*S3) WithContext

func (r *S3) WithContext(ctx context.Context) filesystem.Driver

type Storage

type Storage struct {
	filesystem.Driver
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage() *Storage

func (*Storage) Disk

func (r *Storage) Disk(disk string) filesystem.Driver

Jump to

Keyboard shortcuts

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