stores

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEntryIsExpired = errors.New("entry is expired")

ErrEntryIsExpired is returned when the entry is expired

View Source
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

View Source
var ErrNoValidURL = errors.New("the given URL is no valid URL")

ErrNoValidURL is returned when the URL is not valid

Functions

func IsUniqueConstraintError added in v0.0.6

func IsUniqueConstraintError(err error) bool

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store holds internal funcs and vars about the store

func New

func New(config *config.DBConfiguration) (*Store, error)

New starts a new storage

func (*Store) CreateEntry

func (s *Store) CreateEntry(entry shared.Entry, givenID string) (*shared.Entry, error)

func (*Store) CreateUser added in v0.0.6

func (s *Store) CreateUser(user models.User) (*models.User, error)

CreateUser creates a new User

func (*Store) DeleteEntry

func (s *Store) DeleteEntry(id string) error

DeleteEntry deletes an Entry fully from the DB

func (*Store) FindUserByEmail added in v0.0.6

func (s *Store) FindUserByEmail(email string) (*models.User, error)

FindUserByEmail returns a user if given by email

func (*Store) FindUserByToken added in v0.0.6

func (s *Store) FindUserByToken(token string) (*models.User, error)

func (*Store) GetEntryAndIncrease

func (s *Store) GetEntryAndIncrease(id string) (*shared.Entry, error)

GetEntryAndIncrease the visitor count

func (*Store) GetEntryByID

func (s *Store) GetEntryByID(id string) (*shared.Entry, error)

GetEntryByID returns an entry by ID

func (*Store) LinkUpdate added in v0.0.6

func (s *Store) LinkUpdate(link *shared.Entry) (*shared.Entry, error)

LinkUpdate updates a link

func (s *Store) LinksList() ([]*shared.Entry, error)

LinksList lists all available links

func (*Store) UserUpdateToken added in v0.0.6

func (s *Store) UserUpdateToken(id uint, token string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL