models

package
v0.0.0-...-9b4e594 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFileIsNotLocked = errors.New("file is not locked")

Functions

This section is empty.

Types

type Event

type Event struct {
	Topic string
	Key   string
	Data  any
}

func NewEvent

func NewEvent(topic, key string, data any) (Event, error)

type File

type File struct {
	FileInfo
	// contains filtered or unexported fields
}

func NewFile

func NewFile(
	fileName, filePath, fileKey string, size int64, modTime time.Time, controller FileController,
) (File, error)

func (*File) Lock

func (f *File) Lock(ctx context.Context) error

func (*File) Move

func (f *File) Move(ctx context.Context, newPath string) error

func (*File) Open

func (f *File) Open(ctx context.Context) (io.ReadSeekCloser, error)

func (*File) Unlock

func (f *File) Unlock(ctx context.Context) error

type FileController

type FileController interface {
	Open(ctx context.Context, filepath string) (io.ReadSeekCloser, error)
	Move(ctx context.Context, oldpath string, newpath string) error
	AcquireLock(ctx context.Context, filepath string) (Locker, error)
}

type FileInfo

type FileInfo struct {
	Name     string
	FilePath string
	Key      string
	Size     int64
	ModTime  time.Time
}

type Locker

type Locker interface {
	Unlock() error
}

type ValidationError

type ValidationError struct {
	Message string
}

func (ValidationError) Error

func (e ValidationError) Error() string

type ValidationErrorProps

type ValidationErrorProps struct {
	Context string
	Message string
}

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func (*Validator) AddError

func (e *Validator) AddError(context, message string)

func (Validator) GetError

func (e Validator) GetError() *ValidationError

func (*Validator) HasErrors

func (e *Validator) HasErrors() bool

Jump to

Keyboard shortcuts

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