|
|
|
@ -299,6 +299,9 @@ func GetLabelByID(ctx context.Context, labelID int64) (*Label, error) {
|
|
|
|
|
// GetLabelsByIDs returns a list of labels by IDs
|
|
|
|
|
func GetLabelsByIDs(ctx context.Context, labelIDs []int64, cols ...string) ([]*Label, error) {
|
|
|
|
|
labels := make([]*Label, 0, len(labelIDs))
|
|
|
|
|
if len(labelIDs) == 0 {
|
|
|
|
|
return labels, nil
|
|
|
|
|
}
|
|
|
|
|
return labels, db.GetEngine(ctx).Table("label").
|
|
|
|
|
In("id", labelIDs).
|
|
|
|
|
Asc("name").
|
|
|
|
@ -375,6 +378,9 @@ func BuildLabelNamesIssueIDsCondition(labelNames []string) *builder.Builder {
|
|
|
|
|
// it silently ignores label IDs that do not belong to the repository.
|
|
|
|
|
func GetLabelsInRepoByIDs(ctx context.Context, repoID int64, labelIDs []int64) ([]*Label, error) {
|
|
|
|
|
labels := make([]*Label, 0, len(labelIDs))
|
|
|
|
|
if len(labelIDs) == 0 {
|
|
|
|
|
return labels, nil
|
|
|
|
|
}
|
|
|
|
|
return labels, db.GetEngine(ctx).
|
|
|
|
|
Where("repo_id = ?", repoID).
|
|
|
|
|
In("id", labelIDs).
|
|
|
|
@ -447,6 +453,9 @@ func GetLabelInOrgByID(ctx context.Context, orgID, labelID int64) (*Label, error
|
|
|
|
|
// it silently ignores label IDs that do not belong to the organization.
|
|
|
|
|
func GetLabelsInOrgByIDs(ctx context.Context, orgID int64, labelIDs []int64) ([]*Label, error) {
|
|
|
|
|
labels := make([]*Label, 0, len(labelIDs))
|
|
|
|
|
if len(labelIDs) == 0 {
|
|
|
|
|
return labels, nil
|
|
|
|
|
}
|
|
|
|
|
return labels, db.GetEngine(ctx).
|
|
|
|
|
Where("org_id = ?", orgID).
|
|
|
|
|
In("id", labelIDs).
|
|
|
|
|