model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 7 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferPool = sync.Pool{
	New: func() interface{} {
		return bytes.NewBuffer(make([]byte, 4*1024))
	},
}

BufferPool for io.CopyBuffer

Functions

func ErrNotExist

func ErrNotExist(err error) error

ErrNotExist create a NotExist error

func HandleClose added in v0.0.5

func HandleClose(closer io.Closer, err error) error

HandleClose call properly

func IsNotExist

func IsNotExist(err error) bool

IsNotExist checks if error match a not found

Types

type Item

type Item struct {
	Date      time.Time `json:"date"`
	Name      string    `json:"name"`
	Pathname  string    `json:"pathname"`
	Extension string    `json:"extension"`
	IsDir     bool      `json:"isDir"`
	Size      int64     `json:"size"`
}

Item describe item on a storage provider

func (Item) Dir

func (s Item) Dir() string

Dir return the nearest directory (self of parent)

type Storage

type Storage interface {
	Enabled() bool
	Name() string
	WithIgnoreFn(ignoreFn func(Item) bool) Storage
	Path(pathname string) string
	Info(pathname string) (Item, error)
	List(pathname string) ([]Item, error)
	WriteTo(pathname string, reader io.Reader) error
	ReadFrom(pathname string) (io.ReadSeekCloser, error)
	Walk(pathname string, walkFn func(Item) error) error
	CreateDir(pathname string) error
	Rename(oldName, newName string) error
	Remove(pathname string) error
	UpdateDate(pathname string, date time.Time) error
}

Storage describe action on a storage provider

Jump to

Keyboard shortcuts

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