fs

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(defaultDisk string, disks []FSDisk)

Types

type DiskConfig

type DiskConfig struct {
	Name            string        `json:"name"`
	Driver          string        `json:"driver"`
	Root            string        `json:"root"`
	BaseUrl         string        `json:"base_url"`
	BaseUrlFn       func() string `json:"-"`
	Provider        string        `json:"provider"`
	Endpoint        string        `json:"endpoint"`
	Region          string        `json:"region"`
	Bucket          string        `json:"bucket"`
	AccessKeyID     string        `json:"access_key_id"`
	SecretAccessKey string        `json:"secret_access_key"`
	ACL             string        `json:"acl"`
}

type FSDisk

type FSDisk interface {
	Name() string
	Url(filepath string) string
	Delete(ctx context.Context, filepath string) error
	Put(ctx context.Context, in io.Reader, size int64, mime, dst string) (*FileInfo, error)
	PutMultipart(ctx context.Context, m *multipart.FileHeader, dsts ...string) (*FileInfo, error)
}

func Disk

func Disk(names ...string) FSDisk

type FileInfo

type FileInfo struct {
	Disk string `json:"disk,omitempty"`
	Path string `json:"path,omitempty"`
	Type string `json:"type,omitempty"`
	Size int    `json:"size,omitempty"`
}

type StorageConfig

type StorageConfig struct {
	DefaultDisk string        `json:"default_disk"`
	DiskConfigs []*DiskConfig `json:"disks"`
}

Jump to

Keyboard shortcuts

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