repository

package
v0.0.0-...-f3391d3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchLink = errors.New("no such link")

ErrNoSuchLink is returned when a given Link does not exist.

Functions

This section is empty.

Types

type Link struct {
	ID    string `json:"id"`
	URL   string `json:"url"`
	Count int    `json:"count"`
}

A Link contains the information related to a shorten link.

type LinkRepository

type LinkRepository interface {
	New(url string) (*Link, error)
	Get(id string) (*Link, error)
	CountVisit(id string) error
}

A LinkRepository provides all the operations to create and store links.

func NewDiskRepository

func NewDiskRepository(path string) (LinkRepository, error)

NewDiskRepository returns a new LinkRepository that stores data in disk using Badger DB.

func NewInMemory

func NewInMemory() LinkRepository

NewInMemory returns a new in-memory Link

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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