This commit is contained in:
fede committed 2026-03-16 20:40:33 -03:00
1 parent 0905005543
commit e33faa687d
2 files changed
+52 -18

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package repository
import (
"strconv"
"url-short/models"
"gorm.io/gorm"
)
func RecuperarUrl(shortUrl string, db *gorm.DB) (string, error) {
var url models.Url
i, err := strconv.ParseInt(shortUrl, 10, 64);
if err != nil {
return "", err
}
result := db.Where(&models.Url{Shorturl: i}).First(&url)
if result.Error != nil {
return "", result.Error
}
return url.Longurl, nil
}