Documentation
¶
Overview ¶
Package storages allows multiple implementation on how to store URLs as shorter names and retrieve them later.
There are currently two types of storage layers, Named and Unnamed. Named storage layers allow the user to provide a short name and a URL Unnamed storage layers only accept the URL to store
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrURLEmpty = errors.New("provided URL is of zero length") ErrShortEmpty = errors.New("provided short name is of zero length") ErrURLNotAbsolute = errors.New("provided URL is not an absolute URL") ErrShortNotSet = errors.New("storage layer doens't have a URL for that short code") ErrShortExhaustion = errors.New("tried to set short, but unable to find a unique shortname within 10 tries") )
Functions ¶
Types ¶
type Filesystem ¶
type Filesystem struct {
Root string
// contains filtered or unexported fields
}
func NewFilesystem ¶
func NewFilesystem(root string) (*Filesystem, error)
func (*Filesystem) Code ¶
func (s *Filesystem) Code(url string) string
func (*Filesystem) Load ¶
func (s *Filesystem) Load(rawShort string) (string, error)
func (*Filesystem) Save ¶
func (s *Filesystem) Save(url string) (string, error)
func (*Filesystem) SaveName ¶
func (s *Filesystem) SaveName(rawShort, url string) error
type Inmem ¶
type Inmem struct {
RandLength int
// contains filtered or unexported fields
}
func NewInmemFromMap ¶
type NamedStorage ¶
type Regex ¶
type Regex struct {
// contains filtered or unexported fields
}
type S3 ¶
type Storage ¶
Source Files
¶
- filesystem.go
- inmem.go
- regex.go
- s3.go
- storage.go
- utils.go
Click to show internal directories.
Click to hide internal directories.