shortner

package
v0.0.0-...-a41518b Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

package shortner generates short url based on target url and given params

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(url []byte, hash string, ln int) (string, error)

Types

type RequestedLongerThanGeneratedError

type RequestedLongerThanGeneratedError struct{}

func (*RequestedLongerThanGeneratedError) Error

type ShortUrlGenerator

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

func NewShortUrlGenerator

func NewShortUrlGenerator(pattern string) (*ShortUrlGenerator, error)

func (ShortUrlGenerator) Generate

func (sg ShortUrlGenerator) Generate(ln int) (string, error)

type Shortner

type Shortner struct {
	Conf shortner.Conf
	// contains filtered or unexported fields
}

func NewShortner

func NewShortner(b *backend.ShushBackend, conf shortner.Conf) (*Shortner, error)

func (Shortner) Hash

func (s Shortner) Hash(u *model.Url, fn string, ln int) error

Hash updates short_url param in-place and store the result in the backend

func (Shortner) IsValidShort

func (s Shortner) IsValidShort(short string) bool

func (Shortner) Random

func (s Shortner) Random(u *model.Url, ln int) error

Random updates short_url param in-place based on random pattern and store the result in the backend

Jump to

Keyboard shortcuts

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