Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotSupported is thrown when the backend store is not supported ErrNotSupported = errors.New("Backend storage not supported.") // ErrNotImplemented is thrown when a method is not implemented by the current backend ErrNotImplemented = errors.New("Call not implemented in current backend") // ErrEntityNotSaved is thrown when an entity can't be save into the backend ErrEntityNotSaved = errors.New("Can't save data") // ErrEntityNotStore is thrown when an entity isn't store into the backend ErrEntityNotStore = errors.New("Not store data") )
Functions ¶
func GetAnalyticsKey ¶
GetAnalyticsKey returns database key for Analytics
func RegisterStorage ¶
func RegisterStorage(name string, f StorageFunc)
Types ¶
type Analytics ¶
type Analytics struct { // LongUrlClicks: Number of clicks on all short URLs pointing to // this long URL. LongURLClicks int64 `json:"longUrlClicks,omitempty,string"` // ShortUrlClicks: Number of clicks on this short URL. ShortURLClicks int64 `json:"shortUrlClicks,omitempty,string"` // UserAgent represents the user agent requester //UserAgents []*StringCount `json:"user_agents,omitempty"` UserAgents map[string]int64 `json:"user_agents,omitempty"` }
Analytics contains click statistics
type Storage ¶
type Storage interface { // Init initialize the storage Init() error // Name identify the storage Name() string // Put a value at the specified key Put(key []byte, value []byte) error // Get a value given its key Get(key []byte) ([]byte, error) // Delete the value at the specified key Delete(key []byte) error // List retrieve all keys List() ([][]byte, error) // Close the store connection Close() error }
Storage represents the Abraracourcix backend storage Each storage should support every call listed here.
type StorageFunc ¶
type StorageFunc func(conf *config.Configuration) (Storage, error)
type URL ¶
type URL struct { // Key is the short URL that expands to the long URL you provided Key string `json:"key"` // LongURL is the long URL to which it expands. LongURL string `json:"url"` // CreationDate is the time at which this short URL was created CreationDate time.Time `json:"creation_date"` }
URL represents an URL into storage backend
Click to show internal directories.
Click to hide internal directories.