storage

package
v0.0.0-...-6407e77 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultKeyBuilder

func DefaultKeyBuilder(prefix string) func(fileName string, dir ...string) string

func KeepFileNameKeyBuilder

func KeepFileNameKeyBuilder() func(fileName string, dir ...string) string

Types

type FileDeleter

type FileDeleter interface {
	DeleteFile(ctx context.Context, key string) error
}

type FileDownloader

type FileDownloader interface {
	IsFileExists(ctx context.Context, key string) (bool, error)
	DownloadFile(ctx context.Context, key string) (io.ReadCloser, string, int64, error) // reader, mime, size
}

type FileMoverCopier

type FileMoverCopier interface {
	MoveFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
	CopyFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
}

type FileUploader

type FileUploader interface {
	UploadFile(ctx context.Context, file io.Reader, size int64, key string) (string, error)
	UploadLocalFile(ctx context.Context, file string, key string) (string, error)
}

type ImageStorage

type ImageStorage interface {
	Storage
	ImageURLHandler
}

type ImageURLHandler

type ImageURLHandler interface {
	URLHandler
	GenerateImageURL(key string, width int) string
}

type TokenGenerator

type TokenGenerator interface {
	// GenerateUploadToken [token, key, url]
	GenerateUploadToken(fileName string, dir string, nameBuilder func(filename string, dir ...string) string) ([3]string, error)
}

type URLHandler

type URLHandler interface {
	GenerateURL(key string) string
	GenerateURLs(keys []string) []string
	ExtractKeyFromURL(uri string) string
	ExtractKeyFromURLWithMode(uri string, strict bool) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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