From 14d04c649f900aecf2cf383090003a4df1a7b1af Mon Sep 17 00:00:00 2001 From: Damillora Date: Sun, 11 Jul 2021 00:48:11 +0700 Subject: [PATCH] Add total to search API --- pkg/services/article.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/services/article.go b/pkg/services/article.go index 7537143..f2f65f9 100644 --- a/pkg/services/article.go +++ b/pkg/services/article.go @@ -12,6 +12,7 @@ import ( type SearchResult struct { Page int `json:"page"` PerPage int `json:"per_page"` + Total int `json:"total"` Result []models.ArticleSearchResult `json:"result"` } @@ -44,6 +45,7 @@ func SearchArticles(q string, page int) (SearchResult, error) { return SearchResult{ Page: page, PerPage: perPage, + Total: searchResult.Found, Result: articles, }, nil }