Documentation ¶
Overview ¶
Package stores provides support to interact with the entries
Index ¶
- Variables
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateEntry(entry shared.Entry, givenID, password string) (string, []byte, error)
- func (s *Store) DeleteEntry(id string, givenHmac []byte) error
- func (s *Store) GetEntryAndIncrease(id string) (*shared.Entry, error)
- func (s *Store) GetEntryByID(id string) (*shared.Entry, error)
- func (s *Store) GetUserEntries(oAuthProvider, oAuthID string) (map[string]shared.Entry, error)
- func (s *Store) GetVisitors(id string) ([]shared.Visitor, error)
- func (s *Store) RegisterVisit(id string, visitor shared.Visitor)
Constants ¶
This section is empty.
Variables ¶
var ErrEntryIsExpired = errors.New("entry is expired")
ErrEntryIsExpired is returned when the entry is expired
var ErrGeneratingIDFailed = errors.New("could not generate unique id, all ten tries failed")
ErrGeneratingIDFailed is returned when the 10 tries to generate an id failed
var ErrNoValidURL = errors.New("the given URL is no valid URL")
ErrNoValidURL is returned when the URL is not valid
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds internal funcs and vars about the store
func (*Store) CreateEntry ¶
CreateEntry creates a new record and returns his short id
func (*Store) DeleteEntry ¶
DeleteEntry deletes an Entry fully from the DB
func (*Store) GetEntryAndIncrease ¶
GetEntryAndIncrease Increases the visitor count, checks if the URL is expired and returns the origin URL
func (*Store) GetEntryByID ¶
GetEntryByID returns a unmarshalled entry of the db by a given ID
func (*Store) GetUserEntries ¶
GetUserEntries returns all the shorted URL entries of an user
func (*Store) GetVisitors ¶
GetVisitors returns all the visits of a shorted URL