db

package
v0.0.0-...-4975306 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrNotFound

func NewErrNotFound(message string) error

Types

type DBer

type DBer interface {
	Create(string, *StoredURL) error
	Get(string) (*StoredURL, error)
}

type DynamoService

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

DynamoService satisfies the DBer interface

func NewDynamoService

func NewDynamoService() *DynamoService

func (*DynamoService) Create

func (d *DynamoService) Create(key string, data *StoredURL) error

func (*DynamoService) Get

func (d *DynamoService) Get(key string) (*StoredURL, error)

type ErrBase

type ErrBase struct {
	Message string
}

func (*ErrBase) Error

func (e *ErrBase) Error() string

type ErrCollision

type ErrCollision struct {
	ErrBase
}

func NewErrCollision

func NewErrCollision(message string) *ErrCollision

type ErrDB

type ErrDB struct {
	ErrBase
}

func NewErrDB

func NewErrDB(message string) *ErrDB

type ErrNotFound

type ErrNotFound struct {
	ErrBase
}

type Item

type Item struct {
	// slightly annoying that capitalisation is inconsistent amongst keys but no biggy!
	Hash        string `json:"Hash"`
	OriginalURL string `json:"original_url"`
}

type MapDB

type MapDB struct {
	M map[string]*StoredURL
}

func NewMapDB

func NewMapDB() *MapDB

func (*MapDB) Create

func (m *MapDB) Create(key string, value *StoredURL) error

func (*MapDB) Get

func (m *MapDB) Get(key string) (*StoredURL, error)

type StoredURL

type StoredURL struct {
	OriginalURL string `json:"original_string"`
}

Jump to

Keyboard shortcuts

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