Last active
July 22, 2016 10:39
-
-
Save danhuynhdev/19bca4e4ca1e7e57ffbbe287e19bd670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if url.ShortID == "" { | |
for { | |
shortId, err := GenerateID() | |
if err != nil { | |
http.Error(res, err.Error(), 500) | |
return | |
} | |
url = URL{ShortID: shortId, OriginalURL: original} | |
if db.NewRecord(url) { | |
break | |
} | |
} | |
db.Create(&url) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment