model

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 12 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRelativePath = errors.New("pathname contains relatives paths")
	ErrInvalidPath  = errors.New("pathname is invalid")
)

Functions

func Dirname

func Dirname(name string) string

func ErrNotExist

func ErrNotExist(err error) error

func ID added in v0.4.3

func ID(pathname string) string

func IsNotExist

func IsNotExist(err error) bool

func ValidPath added in v1.4.4

func ValidPath(pathname string) error

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"`
	Size      int64       `json:"size"`
	FileMode  os.FileMode `json:"fileMode"`
	IsDir     bool        `json:"isDir"`
}

func (Item) Dir

func (i Item) Dir() string

func (Item) Info added in v1.4.4

func (i Item) Info() fs.FileInfo

func (Item) IsZero added in v1.0.4

func (i Item) IsZero() bool

func (Item) String added in v1.0.10

func (i Item) String() string

type ItemInfo added in v1.4.3

type ItemInfo struct {
	Item
}

func (ItemInfo) IsDir added in v1.4.3

func (ii ItemInfo) IsDir() bool

func (ItemInfo) ModTime added in v1.4.3

func (ii ItemInfo) ModTime() time.Time

func (ItemInfo) Mode added in v1.4.3

func (ii ItemInfo) Mode() os.FileMode

func (ItemInfo) Name added in v1.4.3

func (ii ItemInfo) Name() string

func (ItemInfo) Size added in v1.4.3

func (ii ItemInfo) Size() int64

func (ItemInfo) Sys added in v1.4.3

func (ii ItemInfo) Sys() any

type ReadAtSeekCloser added in v1.4.4

type ReadAtSeekCloser interface {
	io.ReadSeekCloser
	io.ReaderAt
}

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) (ReadAtSeekCloser, 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