|
@@ -3,22 +3,17 @@ package domain
|
|
var shortURLRepository ShortURLRepository
|
|
var shortURLRepository ShortURLRepository
|
|
var targetURLRepository TargetURLRepository
|
|
var targetURLRepository TargetURLRepository
|
|
|
|
|
|
-func GetTargetURL(shortURL string) (string, error) {
|
|
|
|
- return "", nil
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-func GetShortURL(targetURL string) (string, error) {
|
|
|
|
- return "", nil
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
type ShortURLRepository interface {
|
|
type ShortURLRepository interface {
|
|
GetTarget(su ShortURL) (TargetURL, error)
|
|
GetTarget(su ShortURL) (TargetURL, error)
|
|
- GetByTarget(tu TargetURL) (ShortURL, error)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
type TargetURLRepository interface {
|
|
type TargetURLRepository interface {
|
|
- GetShort(tu TargetURL) (ShortURL, error)
|
|
+
|
|
- GetByShort(su ShortURL) (TargetURL, error)
|
|
+ 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) {
|
|
func RegisterRepositories(sur ShortURLRepository, tur TargetURLRepository) {
|