Fix - Rename method (#13)

This commit is contained in:
Yanislav Igonin 2022-04-05 21:17:08 +03:00 committed by GitHub
parent edb39360d2
commit 4f23b5dc71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ func GetThreads(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "500.html", nil) c.HTML(http.StatusInternalServerError, "500.html", nil)
return return
} }
count, err := Repositories.Posts.GetCount() count, err := Repositories.Posts.GetThreadsCount()
if err != nil { if err != nil {
log.Println("error:", err) log.Println("error:", err)
c.HTML(http.StatusInternalServerError, "500.html", nil) c.HTML(http.StatusInternalServerError, "500.html", nil)
@ -140,7 +140,7 @@ func CreateThread(c *gin.Context) {
} }
defer conn.Release() defer conn.Release()
threadsCount, err := Repositories.Posts.GetCount() threadsCount, err := Repositories.Posts.GetThreadsCount()
if err != nil { if err != nil {
log.Println("error:", err) log.Println("error:", err)
c.HTML(http.StatusInternalServerError, "500.html", nil) c.HTML(http.StatusInternalServerError, "500.html", nil)

View File

@ -61,7 +61,7 @@ func (r *PostsRepository) Get(limit, offset int) ([]Post, error) {
return posts, nil return posts, nil
} }
func (r *PostsRepository) GetCount() (int, error) { func (r *PostsRepository) GetThreadsCount() (int, error) {
sql := ` sql := `
SELECT COUNT(*) SELECT COUNT(*)
FROM posts FROM posts