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