aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_label.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issue_label.go')
-rw-r--r--models/issue_label.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/issue_label.go b/models/issue_label.go
index d1ff469236..5d50203b5a 100644
--- a/models/issue_label.go
+++ b/models/issue_label.go
@@ -444,6 +444,11 @@ func GetLabelsByRepoID(repoID int64, sortType string, listOptions ListOptions) (
return getLabelsByRepoID(x, repoID, sortType, listOptions)
}
+// CountLabelsByRepoID count number of all labels that belong to given repository by ID.
+func CountLabelsByRepoID(repoID int64) (int64, error) {
+ return x.Where("repo_id = ?", repoID).Count(&Label{})
+}
+
// ________
// \_____ \_______ ____
// / | \_ __ \/ ___\
@@ -556,6 +561,11 @@ func GetLabelsByOrgID(orgID int64, sortType string, listOptions ListOptions) ([]
return getLabelsByOrgID(x, orgID, sortType, listOptions)
}
+// CountLabelsByOrgID count all labels that belong to given organization by ID.
+func CountLabelsByOrgID(orgID int64) (int64, error) {
+ return x.Where("org_id = ?", orgID).Count(&Label{})
+}
+
// .___
// | | ______ ________ __ ____
// | |/ ___// ___/ | \_/ __ \