files

package
v0.0.0-...-059fb3b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPath   = errors.New("invalid path")
	ErrInodeNotAFile = errors.New("inode doesn't point to a file")
	ErrNotExist      = errors.New("file not exists")
)
View Source
var ExampleFile1 = FileMeta{
	// contains filtered or unexported fields
}
View Source
var ExampleFile2 = FileMeta{
	// contains filtered or unexported fields
}
View Source
var ExampleSealedKey secret.SealedKey

Functions

This section is empty.

Types

type FakeFileBuilder

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

func NewFakeFile

func NewFakeFile(t *testing.T) *FakeFileBuilder

func (*FakeFileBuilder) Build

func (f *FakeFileBuilder) Build() *FileMeta

func (*FakeFileBuilder) BuildAndStore

func (f *FakeFileBuilder) BuildAndStore(ctx context.Context, db *sql.DB) *FileMeta

func (*FakeFileBuilder) WithContent

func (f *FakeFileBuilder) WithContent(content []byte) *FakeFileBuilder

type FileMeta

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

func (*FileMeta) Checksum

func (f *FileMeta) Checksum() string

func (*FileMeta) ID

func (f *FileMeta) ID() uuid.UUID

func (*FileMeta) MimeType

func (f *FileMeta) MimeType() string

func (*FileMeta) Size

func (f *FileMeta) Size() uint64

func (*FileMeta) UploadedAt

func (f *FileMeta) UploadedAt() time.Time

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockService) Delete

func (_m *MockService) Delete(ctx context.Context, fileID uuid.UUID) error

Delete provides a mock function with given fields: ctx, fileID

func (*MockService) Download

func (_m *MockService) Download(ctx context.Context, file *FileMeta) (io.ReadSeekCloser, error)

Download provides a mock function with given fields: ctx, file

func (*MockService) GetMetadata

func (_m *MockService) GetMetadata(ctx context.Context, fileID uuid.UUID) (*FileMeta, error)

GetMetadata provides a mock function with given fields: ctx, fileID

func (*MockService) Upload

func (_m *MockService) Upload(ctx context.Context, r io.Reader) (*FileMeta, error)

Upload provides a mock function with given fields: ctx, r

type Result

type Result struct {
	fx.Out
	Service Service
}

func Init

func Init(
	masterkey masterkey.Service,
	dirPath string,
	fs afero.Fs,
	tools tools.Tools,
	db *sql.DB,
) (Result, error)

type Service

type Service interface {
	Upload(ctx context.Context, r io.Reader) (*FileMeta, error)
	Download(ctx context.Context, file *FileMeta) (io.ReadSeekCloser, error)
	Delete(ctx context.Context, fileID uuid.UUID) error
	GetMetadata(ctx context.Context, fileID uuid.UUID) (*FileMeta, error)
}

Jump to

Keyboard shortcuts

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