From 4f23b5dc71f2bb1d163e4381840707b08802972a Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Tue, 5 Apr 2022 21:17:08 +0300 Subject: [PATCH] Fix - Rename method (#13) --- controllers/threads_controller.go | 4 ++-- repositories/posts_repository.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/threads_controller.go b/controllers/threads_controller.go index 7c501be..dbe86b4 100644 --- a/controllers/threads_controller.go +++ b/controllers/threads_controller.go @@ -39,7 +39,7 @@ func GetThreads(c *gin.Context) { c.HTML(http.StatusInternalServerError, "500.html", nil) return } - count, err := Repositories.Posts.GetCount() + count, err := Repositories.Posts.GetThreadsCount() if err != nil { log.Println("error:", err) c.HTML(http.StatusInternalServerError, "500.html", nil) @@ -140,7 +140,7 @@ func CreateThread(c *gin.Context) { } defer conn.Release() - threadsCount, err := Repositories.Posts.GetCount() + threadsCount, err := Repositories.Posts.GetThreadsCount() if err != nil { log.Println("error:", err) c.HTML(http.StatusInternalServerError, "500.html", nil) diff --git a/repositories/posts_repository.go b/repositories/posts_repository.go index e846a00..309bbfa 100644 --- a/repositories/posts_repository.go +++ b/repositories/posts_repository.go @@ -61,7 +61,7 @@ func (r *PostsRepository) Get(limit, offset int) ([]Post, error) { return posts, nil } -func (r *PostsRepository) GetCount() (int, error) { +func (r *PostsRepository) GetThreadsCount() (int, error) { sql := ` SELECT COUNT(*) FROM posts