domain.go 632 B

123456789101112131415161718192021222324252627
  1. package domain
  2. var shortURLRepository ShortURLRepository
  3. var targetURLRepository TargetURLRepository
  4. func GetTargetURL(shortURL string) (string, error) {
  5. return "", nil
  6. }
  7. func GetShortURL(targetURL string) (string, error) {
  8. return "", nil
  9. }
  10. type ShortURLRepository interface {
  11. GetTarget(su ShortURL) (TargetURL, error)
  12. GetByTarget(tu TargetURL) (ShortURL, error)
  13. }
  14. type TargetURLRepository interface {
  15. GetShort(tu TargetURL) (ShortURL, error)
  16. GetByShort(su ShortURL) (TargetURL, error)
  17. }
  18. func RegisterRepositories(sur ShortURLRepository, tur TargetURLRepository) {
  19. shortURLRepository = sur
  20. targetURLRepository = tur
  21. }