declare type FormatedLevelMetric explicitly

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2019-06-30 19:39:50 +08:00
parent d57bcb5c29
commit cbec574fa3
2 changed files with 9 additions and 14 deletions

View File

@@ -239,19 +239,11 @@ func Page(pageNum string, limitNum string, fmtLevelMetric *FormatedLevelMetric,
allPage := int(math.Ceil(float64(maxLength) / float64(limit)))
// add page fields
return &struct {
*FormatedLevelMetric
CurrentPage int `json:"page"`
TotalPage int `json:"total_page"`
TotalItem int `json:"total_item"`
Message string `json:"msg"`
}{
FormatedLevelMetric: fmtLevelMetric,
CurrentPage: page,
TotalItem: maxLength,
TotalPage: allPage,
Message: "paged",
}
fmtLevelMetric.CurrentPage = page
fmtLevelMetric.TotalItem = maxLength
fmtLevelMetric.TotalPage = allPage
return fmtLevelMetric
}
// maybe this function is time consuming