redirect

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

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedirectAPIHandler

func NewRedirectAPIHandler(service RedirectService) chi.Router

func NewRedirectHandler

func NewRedirectHandler(service RedirectService) chi.Router

Types

type DB

type DB interface {
	GetURL(ctx context.Context, id int64) (URL, error)
	CreateURL(ctx context.Context, params URLParams) (URL, error)
}

type RedirectAPIHandler

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

type RedirectHandler

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

type RedirectService

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

func NewRedirectService

func NewRedirectService(db DB) RedirectService

func (RedirectService) CreateURL

func (s RedirectService) CreateURL(ctx context.Context, params URLParams) (URL, error)

func (RedirectService) GetURL

func (s RedirectService) GetURL(ctx context.Context, id int64) (URL, error)

type RepositoryImpl

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

func NewRepository

func NewRepository(db *sqlx.DB) RepositoryImpl

func (RepositoryImpl) CreateURL

func (repo RepositoryImpl) CreateURL(ctx context.Context, params URLParams) (URL, error)

func (RepositoryImpl) GetURL

func (repo RepositoryImpl) GetURL(ctx context.Context, id int64) (URL, error)

type URL

type URL struct {
	ID  int64
	URL string
}

type URLParams

type URLParams struct {
	URL string
}

type URLRequest

type URLRequest struct {
	URL string `json:"url"`
}

type URLResponse

type URLResponse struct {
	Key string `json:"key"`
	URL string `json:"url"`
}

Jump to

Keyboard shortcuts

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