Documentation ¶
Index ¶
- func GetStringOrDefault(values map[string]string, key, defaultValue string) string
- func Presign(source *Source, k8sCache k8s.Cache, paths ...string) (presignedUrls []string, status int, err error)
- type CreateBody
- type Link
- type Source
- type Storage
- func (s *Storage) All() ([]*Link, error)
- func (s *Storage) Delete(hash string) error
- func (s *Storage) FindByUserID(id uint) ([]*Link, error)
- func (s *Storage) GetByHash(hash string) (*Link, error)
- func (s *Storage) GetPermanent(path string, id uint) (*Link, error)
- func (s *Storage) Gets(path, sourceName string, id uint) ([]*Link, error)
- func (s *Storage) Save(l *Link) error
- type StorageBackend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStringOrDefault ¶
Types ¶
type CreateBody ¶
type Link ¶
type Link struct { Hash string `json:"hash" storm:"id,index"` Path string `json:"path" storm:"index"` Source Source `json:"source"` UserID uint `json:"userID"` Expire int64 `json:"expire"` PasswordHash string `json:"password_hash,omitempty"` // Token is a random value that will only be set when PasswordHash is set. It is // URL-Safe and is used to download links in password-protected shares via a // query arg. Token string `json:"token,omitempty"` Description string `json:"description,omitempty"` }
Link is the information needed to build a shareable link.
type Source ¶
type Source struct { Name string `json:"name"` FriendlyName string `json:"friendlyName,omitempty"` SecretName string `json:"secretName"` BucketName string `json:"bucketName"` BucketPrefix string `json:"bucketPrefix,omitempty"` PresignSecretName string `json:"presignSecretName"` PresignBucketName string `json:"presignBucketName"` PresignBucketPrefix string `json:"presignBucketPrefix,omitempty"` SubPath string `json:"subPath,omitempty"` }
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a storage.
func NewStorage ¶
func NewStorage(back StorageBackend) *Storage
NewStorage creates a share links storage from a backend.
func (*Storage) FindByUserID ¶
FindByUserID wraps a StorageBackend.FindByUserID.
func (*Storage) GetPermanent ¶
GetPermanent wraps a StorageBackend.GetPermanent
type StorageBackend ¶
type StorageBackend interface { All() ([]*Link, error) FindByUserID(id uint) ([]*Link, error) GetByHash(hash string) (*Link, error) GetPermanent(path string, id uint) (*Link, error) Gets(path string, sourceName string, id uint) ([]*Link, error) Save(s *Link) error Delete(hash string) error }
StorageBackend is the interface to implement for a share storage.
Click to show internal directories.
Click to hide internal directories.