Documentation ¶
Index ¶
- Variables
- func NewURLService(urlStore model.IURLStore) model.IURLService
- type GetURLByLong
- type GetURLByShort
- type PSQLStore
- func (s *PSQLStore) CreateURL(ctx context.Context, url *model.URL) error
- func (s *PSQLStore) QueryURL(ctx context.Context, id model.URLID) (*model.URL, error)
- func (s *PSQLStore) QueryURLByLong(ctx context.Context, long model.LongURL) (*model.URL, error)
- func (s *PSQLStore) QueryURLByShort(ctx context.Context, short model.ShortURL) (*model.URL, error)
- type ShortenURL
- type URLService
- func (s *URLService) GetURLByLong(ctx context.Context, long model.LongURL) (*model.URL, error)
- func (s *URLService) GetURLByShort(ctx context.Context, short model.ShortURL) (*model.URL, error)
- func (s *URLService) InsertURL(ctx context.Context, url *model.URL) error
- func (s *URLService) ShortenURL(ctx context.Context, long model.LongURL) (model.ShortURL, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLongURLEmpty = errors.New("long URL cannot be empty")
View Source
var ErrShortURLEmpty = errors.New("short URL cannot be empty")
Functions ¶
func NewURLService ¶
func NewURLService(urlStore model.IURLStore) model.IURLService
Types ¶
type GetURLByLong ¶
type GetURLByLong struct {
// contains filtered or unexported fields
}
func NewGetURLByLong ¶
func NewGetURLByLong(long string) (*GetURLByLong, error)
func (*GetURLByLong) Execute ¶
func (c *GetURLByLong) Execute(ctx context.Context, s model.IURLService) (*model.URL, error)
type GetURLByShort ¶
type GetURLByShort struct {
// contains filtered or unexported fields
}
func NewGetURLByShort ¶
func NewGetURLByShort(short string) (*GetURLByShort, error)
func (*GetURLByShort) Execute ¶
func (c *GetURLByShort) Execute(ctx context.Context, s model.IURLService) (*model.URL, error)
type PSQLStore ¶
type PSQLStore struct {
// contains filtered or unexported fields
}
func NewPSQLStore ¶
func (*PSQLStore) QueryURLByLong ¶
QueryURLByLong queries the database for a URL with the given long URL.
type ShortenURL ¶
type ShortenURL struct {
// contains filtered or unexported fields
}
func NewShortenURL ¶
func NewShortenURL(long string) (*ShortenURL, error)
func (*ShortenURL) Execute ¶
func (c *ShortenURL) Execute(ctx context.Context, s model.IURLService) (*model.URL, error)
type URLService ¶
type URLService struct {
// contains filtered or unexported fields
}
func (*URLService) GetURLByLong ¶
GetURLByLong gets the URL object associated with the given long URL.
func (*URLService) GetURLByShort ¶
GetURLByShort gets the URL object associated with the given short URL.
func (*URLService) ShortenURL ¶
ShortenURL is a function that generates a URL object for a given URL.
Click to show internal directories.
Click to hide internal directories.