优化主页指标展示

This commit is contained in:
marvzhang
2020-03-22 09:25:54 +08:00
parent fac2558b20
commit e89e7ea755
4 changed files with 112 additions and 49 deletions

View File

@@ -152,3 +152,16 @@ func RemoveProject(id bson.ObjectId) error {
return nil
}
func GetProjectCount(filter interface{}) (int, error) {
s, c := database.GetCol("projects")
defer s.Close()
count, err := c.Find(filter).Count()
if err != nil {
return 0, err
}
return count, nil
}