feat: ahora puede generar numeros negativos
All checks were successful
Build Urlshort / publish (push) Successful in 1m34s
All checks were successful
Build Urlshort / publish (push) Successful in 1m34s
This commit is contained in:
@@ -40,7 +40,7 @@ func CrearUrl(longURL string, db *gorm.DB) (string, error) {
|
|||||||
|
|
||||||
var url models.Url
|
var url models.Url
|
||||||
for {
|
for {
|
||||||
url.Shorturl = rand.Int64()
|
url.Shorturl = int64(rand.Uint64())
|
||||||
result = db.Model(&models.Url{}).Where("shorturl = ?", url.Shorturl).Count(&counturl)
|
result = db.Model(&models.Url{}).Where("shorturl = ?", url.Shorturl).Count(&counturl)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
return "", result.Error
|
return "", result.Error
|
||||||
|
|||||||
Reference in New Issue
Block a user