shorten

package
v0.0.0-...-c8ee330 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateShortenUrl

func GenerateShortenUrl(id uint32) string

Types

type Service

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

func NewService

func NewService(storage Storage) *Service

func (*Service) CreateShorten

func (s *Service) CreateShorten(ctx context.Context, input model.InputShorten) (*model.Shorten, error)

func (*Service) DeleteShorten

func (s *Service) DeleteShorten(ctx context.Context, shortUrl string) (int64, error)

func (*Service) GetShorten

func (s *Service) GetShorten(ctx context.Context, shortUrl string) (*model.Shorten, error)

func (*Service) Redirect

func (s *Service) Redirect(ctx context.Context, shortUrl string) (string, error)

type Storage

type Storage interface {
	CreateShorten(ctx context.Context, ms model.Shorten) error
	GetShorten(ctx context.Context, shortUrl string) (*model.Shorten, error)
	DeleteShorten(ctx context.Context, shortUrl string) (int64, error)
	UpdateShorten(ctx context.Context, shortUrl string) error
}

Jump to

Keyboard shortcuts

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