mirror of
https://github.com/Damillora/Yuriko.git
synced 2024-11-21 17:27:33 +00:00
Add total to search API
This commit is contained in:
parent
eb25a333e7
commit
14d04c649f
@ -12,6 +12,7 @@ import (
|
|||||||
type SearchResult struct {
|
type SearchResult struct {
|
||||||
Page int `json:"page"`
|
Page int `json:"page"`
|
||||||
PerPage int `json:"per_page"`
|
PerPage int `json:"per_page"`
|
||||||
|
Total int `json:"total"`
|
||||||
Result []models.ArticleSearchResult `json:"result"`
|
Result []models.ArticleSearchResult `json:"result"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ func SearchArticles(q string, page int) (SearchResult, error) {
|
|||||||
return SearchResult{
|
return SearchResult{
|
||||||
Page: page,
|
Page: page,
|
||||||
PerPage: perPage,
|
PerPage: perPage,
|
||||||
|
Total: searchResult.Found,
|
||||||
Result: articles,
|
Result: articles,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user