model

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 11 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Dirname

func Dirname(name string) string

func ErrNotExist

func ErrNotExist(err error) error

func HandleClose added in v0.0.5

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

func ID added in v0.4.3

func ID(pathname string) string

func IsNotExist

func IsNotExist(err error) bool

Types

type Item

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

func (Item) Dir

func (s Item) Dir() string

type Storage

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

type WriteOpts added in v1.0.2

type WriteOpts struct {
	Size int64
}

Jump to

Keyboard shortcuts

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