service

package
v0.0.0-...-4af97ca Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ShortCodeGenerator

type ShortCodeGenerator interface {
	GenerateCode(length int) string
}

type UrlRepository

type UrlRepository interface {
	Create(ctx context.Context, url model.URL) error
	GetByShorted(ctx context.Context, shorted string) (string, error)
}

type Urls

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

func NewUrls

func NewUrls(generator ShortCodeGenerator, repo UrlRepository) *Urls

func (*Urls) Redirect

func (u *Urls) Redirect(ctx context.Context, request *api.RedirectRequest) (*api.RedirectResponse, error)

func (*Urls) Shorten

func (u *Urls) Shorten(ctx context.Context, request *api.ShortenRequest) (*api.ShortenResponse, error)

Jump to

Keyboard shortcuts

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