storage

package
v0.0.0-...-c8fcf73 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateFileDTO

type CreateFileDTO struct {
	Name   string `json:"name"`
	Size   int64  `json:"size"`
	Reader io.Reader
}

type File

type File struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Size  int64  `json:"size"`
	Bytes []byte `json:"bytes"`
}

func NewFile

func NewFile(dto CreateFileDTO) (*File, error)

type Service

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

func NewService

func NewService(log *logrus.Logger, noteStorage Storage) (*Service, error)

func (*Service) Create

func (s *Service) Create(ctx context.Context, noteUUID string, dto CreateFileDTO) error

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, noteUUID, fileName string) error

func (*Service) GetFile

func (s *Service) GetFile(ctx context.Context, noteUUID, fileID string) (f *File, err error)

func (*Service) GetFilesByNoteUUID

func (s *Service) GetFilesByNoteUUID(ctx context.Context, noteUUID string) ([]*File, error)

type Storage

type Storage interface {
	GetFile(ctx context.Context, bucketName, fileName string) (*File, error)
	GetFilesByNoteUUID(ctx context.Context, uuid string) ([]*File, error)
	CreateFile(ctx context.Context, noteUUID string, file *File) error
	DeleteFile(ctx context.Context, noteUUID, fileName string) error
}

func New

func New(log *logrus.Logger, endpoint, accessKey, secretKey string) (Storage, error)

Jump to

Keyboard shortcuts

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