shorturl

package
v0.0.0-...-2b4ac10 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxLetters = 7

	HTTPProtocol = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ShortURL

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

func New

func New(s Storage, sheetsConfig model.Sheets, logger *zap.SugaredLogger) ShortURL

func (*ShortURL) All

func (s *ShortURL) All(limit, offset int) (model.ShortURLs, error)

func (*ShortURL) ByShort

func (s *ShortURL) ByShort(shortURL string) (model.ShortURL, error)

func (*ShortURL) ByShortToRedirect

func (s *ShortURL) ByShortToRedirect(shortURL string) (model.ShortURL, error)

func (*ShortURL) Create

func (s *ShortURL) Create(m *model.ShortURL) error

func (*ShortURL) Delete

func (s *ShortURL) Delete(ID uuid.UUID) error

func (*ShortURL) SetUseCaseHistory

func (s *ShortURL) SetUseCaseHistory(useCase UseCaseHistory)

func (*ShortURL) SetUseCaseSheets

func (s *ShortURL) SetUseCaseSheets(useCase UseCaseSheets)

func (*ShortURL) Update

func (s *ShortURL) Update(m *model.ShortURL) error

type Storage

type Storage interface {
	Create(s *model.ShortURL) error
	Update(s *model.ShortURL) error
	IncrementTimes(ID uuid.UUID) error
	Delete(ID uuid.UUID) error
	ByShort(s string) (model.ShortURL, error)
	All(limit, offset int) (model.ShortURLs, error)
}

type UseCase

type UseCase interface {
	Create(s *model.ShortURL) error
	Update(s *model.ShortURL) error
	Delete(ID uuid.UUID) error
	ByShort(shortURL string) (model.ShortURL, error)
	ByShortToRedirect(s string) (model.ShortURL, error)
	All(limit, offset int) (model.ShortURLs, error)
}

type UseCaseHistory

type UseCaseHistory interface {
	Create(m *model.History) error
}

type UseCaseSheets

type UseCaseSheets interface {
	AddRow(short *model.ShortURL, createdAt int64, spreadsheetID string) error
}

Jump to

Keyboard shortcuts

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