123456789101112131415161718192021222324252627282930 |
- package domain
- import (
- "github.com/nicksnyder/go-i18n/v2/i18n"
- )
- var shortURLRepository ShortURLRepository
- var targetURLRepository TargetURLRepository
- type ShortURLRepository interface {
- GetTarget(su ShortURL, localizer *i18n.Localizer) (TargetURL, error)
- }
- /*
- TargetURLRepository is the interface infrastructure needs to implement to
- provide the domain with access to Target URLs.
- */
- type TargetURLRepository interface {
- /*
- GetShort returns the ShortURL for a given TargetURL.
- In the results, isNew will be true if the ShortURL was created for this occasion.
- */
- GetShort(tu TargetURL) (su ShortURL, isNew bool, err error)
- }
- func RegisterRepositories(sur ShortURLRepository, tur TargetURLRepository) {
- shortURLRepository = sur
- targetURLRepository = tur
- }
|