shortener

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: MIT Imports: 4 Imported by: 0

README

type Shortener interface {
    Shorten(url string) string
    Resolve(url string) string
}

Shorten returns short link (example - otus.ru/some-long-link -> otus.ru/jhg34) and saves mapping short link to source link.

Resolve returns source link or empty string if source link was not found.

Tips:

  • Use memory without external DB (we will use it later)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shortener

type Shortener interface {
	// Shorten returns short link (example - otus.ru/some-long-link -> otus.ru/jhg34).
	// Also saves mapping short link to source link.
	Shorten(url string) string
	// Resolve returns source link or empty string if source link was not found.
	Resolve(url string) string
}

func NewShortener

func NewShortener() Shortener

Jump to

Keyboard shortcuts

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