file

package
v0.0.0-...-41af0e9 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSize

type ByteSize float64
const (
	KiB ByteSize
	MiB
	GiB
	TiB
	PiB
	EiB
	ZiB
)

func (ByteSize) String

func (b ByteSize) String() string

type ID

type ID string

func NewFileID

func NewFileID() ID

type Info

type Info struct {
	ID        ID                           `json:"id"`
	Name      string                       `json:"name"`
	Type      string                       `json:"type"`
	Size      ByteSize                     `json:"size"`
	CreatedAt time.Time                    `json:"created_at"`
	DeletedAt optional.Optional[time.Time] `json:"deleted_at"`
}

type Service

type Service interface {
	Upload(context.Context, Info, io.Reader) (ID, error)
	Get(context.Context, ID) (io.ReadCloser, error)
	GetFileInfo(context.Context, ID) (Info, error)
	Delete(context.Context, ID) error
}

type Storage

type Storage interface {
	Store(context.Context, Info) (ID, error)
	Find(context.Context, ID) (Info, error)
	Delete(context.Context, ID) error
}

Jump to

Keyboard shortcuts

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