filemanager: Index | Files

package share

import ""


Package Files

share.go storage.go

type Link struct {
    Hash   string `json:"hash" storm:"id,index"`
    Path   string `json:"path" storm:"index"`
    UserID uint   `json:"userID"`
    Expire int64  `json:"expire"`

Link is the information needed to build a shareable link.

type Storage Uses

type Storage struct {
    // contains filtered or unexported fields

Storage is a storage.

func NewStorage Uses

func NewStorage(back StorageBackend) *Storage

NewStorage creates a share links storage from a backend.

func (*Storage) Delete Uses

func (s *Storage) Delete(hash string) error

Delete wraps a StorageBackend.Delete

func (*Storage) GetByHash Uses

func (s *Storage) GetByHash(hash string) (*Link, error)

GetByHash wraps a StorageBackend.GetByHash.

func (*Storage) GetPermanent Uses

func (s *Storage) GetPermanent(path string, id uint) (*Link, error)

GetPermanent wraps a StorageBackend.GetPermanent

func (*Storage) Gets Uses

func (s *Storage) Gets(path string, id uint) ([]*Link, error)

Gets wraps a StorageBackend.Gets

func (*Storage) Save Uses

func (s *Storage) Save(l *Link) error

Save wraps a StorageBackend.Save

type StorageBackend Uses

type StorageBackend interface {
    GetByHash(hash string) (*Link, error)
    GetPermanent(path string, id uint) (*Link, error)
    Gets(path string, id uint) ([]*Link, error)
    Save(s *Link) error
    Delete(hash string) error

StorageBackend is the interface to implement for a share storage.

Package share imports 2 packages (graph). Updated 2019-07-01. Refresh now. Tools for package owners.