Documentation ¶
Index ¶
- func Encode(number int64) (result string)
- type File
- type LocalStorage
- func (s *LocalStorage) Delete(token, filename string) (err error)
- func (s *LocalStorage) Get(token string, filename string) (reader File, contentType string, contentLength int64, err error)
- func (s *LocalStorage) Head(token string, filename string) (contentType string, contentLength int64, err error)
- func (s *LocalStorage) IsNotExist(err error) bool
- func (s *LocalStorage) Put(token string, filename string, reader io.Reader, contentLength int64) error
- func (s *LocalStorage) String() string
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
Encode encodes a symbol using symbol base Taken from https://github.com/fs111/kurz.go/blob/master/src/codec.go
Types ¶
type LocalStorage ¶
LocalStorage is an implementation of a Storage interface using local directory to store files
func NewLocalStorage ¶
func NewLocalStorage(basedir string) (storage *LocalStorage, err error)
NewLocalStorage returns a LocalStorage instance
func (*LocalStorage) Delete ¶
func (s *LocalStorage) Delete(token, filename string) (err error)
Delete deletes file from a storage
func (*LocalStorage) Get ¶
func (s *LocalStorage) Get(token string, filename string) (reader File, contentType string, contentLength int64, err error)
Get retrieves file from a storage
func (*LocalStorage) Head ¶
func (s *LocalStorage) Head(token string, filename string) (contentType string, contentLength int64, err error)
Head returns content type and content length to use in e.g. HTTP HEAD method
func (*LocalStorage) IsNotExist ¶
func (s *LocalStorage) IsNotExist(err error) bool
IsNotExist checks whether error meaning is file doesn't exists
func (*LocalStorage) Put ¶
func (s *LocalStorage) Put(token string, filename string, reader io.Reader, contentLength int64) error
Put puts file in a storage
func (*LocalStorage) String ¶
func (s *LocalStorage) String() string
String returns a string representation of LocalStorage
type Storage ¶
type Storage interface { String() string Get(token, filename string) (reader File, contentType string, contentLength int64, err error) Head(token, filename string) (contentType string, contentLength int64, err error) Put(token, filename string, reader io.Reader, contentLength int64) error Delete(token, filename string) (err error) IsNotExist(err error) bool }
Storage is a Storage interface
Click to show internal directories.
Click to hide internal directories.