1234567891011121314151617181920212223242526 |
- package domain
- var shortURLRepository ShortURLRepository
- var targetURLRepository TargetURLRepository
- type ShortURLRepository interface {
- GetTarget(su ShortURL) (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
- }
|