Documentation ¶
Index ¶
- Variables
- type Cloud
- type File
- func (f File) Copy(ctx context.Context, fcopy types.CopyFile) (created types.File, err error)
- func (f File) Download(ctx context.Context, id string) (types.DownloadFile, error)
- func (f File) Find(ctx context.Context, folderID string, sort types.Sort) ([]types.File, error)
- func (f File) MarkDelete(ctx context.Context, id []string) error
- func (f File) Move(ctx context.Context, move types.Move) error
- func (f File) Rename(ctx context.Context, file types.File) (types.File, error)
- func (f File) Upload(ctx context.Context, files []types.File) ([]types.Upload, error)
- type FileRepository
- type Folder
- func (f Folder) Create(ctx context.Context, folder types.Folder) (types.Folder, error)
- func (f Folder) Find(ctx context.Context, parentID *string, sort types.Sort) ([]*types.Folder, error)
- func (f Folder) Folder(ctx context.Context, id string) (types.Folder, error)
- func (f Folder) Update(ctx context.Context, folder types.Folder) (types.Folder, error)
- type FolderRepository
- type RemoverFile
- type RemoverMeta
- type Repository
- type Saver
- type SaverFile
- type SaverMeta
- type SaverRemoverFile
- type SaverRemoverMeta
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFolderNotExists = errors.New("folder not exists") ErrFolderParentNotExists = errors.New("parent not exists") )
View Source
var (
ErrFileNotExists = errors.New("file not exists")
)
Functions ¶
This section is empty.
Types ¶
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
func New ¶
func New(repository *Repository) *Cloud
type File ¶
type File struct {
// contains filtered or unexported fields
}
type FileRepository ¶
type FileRepository interface { // IsExists check file exists by id (file id) IsExists(ctx context.Context, id string) (ok bool, err error) // GetByFolderID return files info by folderID (folder binding) GetByFolderID(ctx context.Context, folderID string, sort types.Sort) ([]types.File, error) // UpdateName - update file name where file id // return updated file info UpdateName(ctx context.Context, id, name string) (updated types.File, err error) // UpdateFolderID - update files folder id by files id UpdateFolderID(ctx context.Context, id []string, folderID string) error // Open opening file by name with full file information like: file.txt, // without full dir path // use with file information id like: 4d2e16db-3bb4-430d-b7e6-6844da203595.pdf Open(ctx context.Context, name string) (io.ReadCloser, error) // Copy copied some file // dst is a destination file name with file information (with type) // src is a source file name with file information (with type) Copy(ctx context.Context, dst, src string) (err error) // GetByID getting file by id GetByID(ctx context.Context, id string) (ff types.File, err error) // MarkDelete is a safety delete file info // don't delete some file by mark delete MarkDelete(ctx context.Context, id []string) error }
type Folder ¶
type Folder struct {
// contains filtered or unexported fields
}
type FolderRepository ¶
type FolderRepository interface { // Get getting folder by id Get(ctx context.Context, id string) (*types.Folder, error) // GetByParent recursive getting folders directory where parent id // if parent id is nil, then return root directory. // sort is param to sorting folders tree GetByParent(ctx context.Context, parentID *string, sort types.Sort) (folders []*types.Folder, err error) // Create - create folder and return created folder Create(ctx context.Context, folder types.Folder) (types.Folder, error) // ExistsByID check exists folder where id return ok if folder exists // and return false if file is not exists ExistsByID(ctx context.Context, id string) (bool, error) // ExistsByParentIDName exists file/files by parent id and name // if parent id is nil, then check that name in root directory is exits ExistsByParentIDName(ctx context.Context, parentID *string, name string) (bool, error) // Update - update folder where id and return updated folder Update(ctx context.Context, folder types.Folder) (types.Folder, error) // Delete recursive remove folder and him directory folders like `bash: rm -r` Delete(ctx context.Context, id string) error }
type RemoverFile ¶
type Repository ¶
type Repository struct { File FileRepository Folder FolderRepository Saver Saver }
type Saver ¶
type Saver interface { SaverRemoverMeta SaverRemoverFile }
func NewSaver ¶
func NewSaver(meta SaverRemoverMeta, file SaverRemoverFile) Saver
type SaverRemoverFile ¶
type SaverRemoverFile interface { SaverFile RemoverFile }
type SaverRemoverMeta ¶
type SaverRemoverMeta interface { SaverMeta RemoverMeta }
Click to show internal directories.
Click to hide internal directories.