stores

package
v0.0.0-...-b5a54de Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// :: Config ::
	MongoCacheCleanup      = "MONGO_CACHE_CLEANUP"
	MongoCacheExp          = "MONGO_CACHE_EXP"
	MongoCounterCollection = "MONGO_COL_COUNTERS"
	MongoLinksCollection   = "MONGO_COL_LINKS"
	MongoUrl               = "MONGO_URL"
	MongoDb                = "MONGO_DB"

	// :: Internal ::
	ConnectingMsg = "Connecting to Mongo database"
)
View Source
const (
	BadgerDir = "BADGER_DIR"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerStore

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

func (*BadgerStore) Create

func (b *BadgerStore) Create(code string, longUrl string) (*models.Link, error)

func (*BadgerStore) Delete

func (b *BadgerStore) Delete(code string) int
func (b *BadgerStore) FindLink(hashedLongUrl string) *models.Link

func (*BadgerStore) IncCount

func (b *BadgerStore) IncCount() int

func (*BadgerStore) List

func (b *BadgerStore) List(limit int, skip int) []models.Link

func (*BadgerStore) Read

func (b *BadgerStore) Read(code string) (*models.Link, error)

type MongoStore

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

func (*MongoStore) Create

func (m *MongoStore) Create(code string, longUrl string) (*models.Link, error)

func (*MongoStore) Delete

func (m *MongoStore) Delete(code string) int

func (*MongoStore) IncCount

func (m *MongoStore) IncCount() int

func (*MongoStore) List

func (m *MongoStore) List(limit int, skip int) []models.Link

func (*MongoStore) Read

func (m *MongoStore) Read(code string) (*models.Link, error)

type Store

type Store interface {
	IncCount() int
	Create(code string, url string) (*models.Link, error)
	Read(code string) (*models.Link, error)
	List(limit int, skip int) []models.Link
	Delete(code string) int
}

func NewBadgerStore

func NewBadgerStore() Store

func NewMongoStore

func NewMongoStore() Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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