storage

package
v0.0.0-...-f21c627 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

Repository the repository structure to create and retrieve Shortened URLs

func New

func New(db *gorm.DB) *Repository

New returns a new repository configured with the given 'db'

func (*Repository) Create

func (r *Repository) Create(fullURL string) (*string, error)

Create creates a new entry

func (*Repository) Lookup

func (r *Repository) Lookup(shortURL string) (*string, error)

Lookup looks-up an entry in the DB

type ShortenedURL

type ShortenedURL struct {
	ID        uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
	CreatedAt time.Time
	LongURL   string
	ShortURL  string
}

ShortenedURL the structure for shortened URLs

func (ShortenedURL) TableName

func (ShortenedURL) TableName() string

TableName set ShortenedURL's table name to be `urls`

Jump to

Keyboard shortcuts

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