Documentation
¶
Index ¶
- Variables
- type GetUrlByTokenInput
- type GetUrlByUrlInput
- type SaveUrlInput
- type Service
- func (s *Service) GetUrlByToken(ctx context.Context, input *GetUrlByTokenInput) (*entity.UrlEntry, error)
- func (s *Service) GetUrlByUrl(ctx context.Context, input *GetUrlByUrlInput) (*entity.UrlEntry, error)
- func (s *Service) SaveUrl(ctx context.Context, input *SaveUrlInput) (*entity.UrlEntry, error)
- func (s *Service) VisitUrlByToken(ctx context.Context, input *VisitUrlByTokenInput) error
- type UrlEntryRepository
- type VisitUrlByTokenInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrValidation = errors.New("validation error")
ErrValidation is a generic validation error that can be returned when input validation fails
Functions ¶
This section is empty.
Types ¶
type GetUrlByTokenInput ¶
type GetUrlByTokenInput struct {
Token string
// contains filtered or unexported fields
}
GetUrlInput is the input struct for the GetUrl method
type GetUrlByUrlInput ¶
type GetUrlByUrlInput struct {
Url string
// contains filtered or unexported fields
}
GetUrlInput is the input struct for the GetUrl method
type SaveUrlInput ¶
type SaveUrlInput struct {
Url string
// contains filtered or unexported fields
}
SaveUrlInput is the input struct for the SaveUrl method
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) GetUrlByToken ¶
func (s *Service) GetUrlByToken(ctx context.Context, input *GetUrlByTokenInput) (*entity.UrlEntry, error)
GetUrl will get the url entry from the url string
func (*Service) GetUrlByUrl ¶
func (s *Service) GetUrlByUrl(ctx context.Context, input *GetUrlByUrlInput) (*entity.UrlEntry, error)
GetUrl will get the url entry from the url string
func (*Service) VisitUrlByToken ¶
func (s *Service) VisitUrlByToken(ctx context.Context, input *VisitUrlByTokenInput) error
VisitUrl will increment the number of times the url has been visited
type UrlEntryRepository ¶
type UrlEntryRepository interface {
// Save will url entry to the store
SaveUrl(ctx context.Context, url entity.Url) (entry *entity.UrlEntry, err error)
// SaveVisit will increment the number of times the url has been visited
SaveVisit(ctx context.Context, token entity.UrlToken) error
// GetFromToken will get the url entry from the token
GetFromToken(ctx context.Context, token entity.UrlToken) (*entity.UrlEntry, error)
// GetFromUrl will get the url entry from the url
GetFromUrl(ctx context.Context, url entity.Url) (*entity.UrlEntry, error)
}
UrlEntryRepository is the interface that defines the method that the service will use to interact with the repository
type VisitUrlByTokenInput ¶
type VisitUrlByTokenInput struct {
Token string
// contains filtered or unexported fields
}
VisitUrlInput is the input struct for the VisitUrl method
Click to show internal directories.
Click to hide internal directories.