shorten

package
v0.0.0-...-70c7384 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrependBaseURL

func PrependBaseURL(baseURL, identifier string) (string, error)

func Shorten

func Shorten(id uint32) string

Types

type Service

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

func NewService

func NewService(storage Storage) *Service

func (*Service) Get

func (s *Service) Get(ctx context.Context, identifier string) (*model.Shortening, error)

func (*Service) Redirect

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

func (*Service) Shorten

func (s *Service) Shorten(ctx context.Context, input model.ShortenInput) (*model.Shortening, error)

type Storage

type Storage interface {
	Put(ctx context.Context, shortening model.Shortening) (*model.Shortening, error)
	Get(ctx context.Context, identifier string) (*model.Shortening, error)
	IncrementVisits(ctx context.Context, identifier string) error
}

Jump to

Keyboard shortcuts

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