|
|
@ -203,13 +203,26 @@ func GetLabelInRepoByName(repoID int64, labelName string) (*Label, error) { |
|
|
|
return getLabelInRepoByName(x, repoID, labelName) |
|
|
|
return getLabelInRepoByName(x, repoID, labelName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GetLabelIDsInRepoByNames returns a list of labelIDs by names in a given
|
|
|
|
|
|
|
|
// repository.
|
|
|
|
|
|
|
|
// it silently ignores label names that do not belong to the repository.
|
|
|
|
|
|
|
|
func GetLabelIDsInRepoByNames(repoID int64, labelNames []string) ([]int64, error) { |
|
|
|
|
|
|
|
labelIDs := make([]int64, 0, len(labelNames)) |
|
|
|
|
|
|
|
return labelIDs, x.Table("label"). |
|
|
|
|
|
|
|
Where("repo_id = ?", repoID). |
|
|
|
|
|
|
|
In("name", labelNames). |
|
|
|
|
|
|
|
Asc("name"). |
|
|
|
|
|
|
|
Cols("id"). |
|
|
|
|
|
|
|
Find(&labelIDs) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetLabelInRepoByID returns a label by ID in given repository.
|
|
|
|
// GetLabelInRepoByID returns a label by ID in given repository.
|
|
|
|
func GetLabelInRepoByID(repoID, labelID int64) (*Label, error) { |
|
|
|
func GetLabelInRepoByID(repoID, labelID int64) (*Label, error) { |
|
|
|
return getLabelInRepoByID(x, repoID, labelID) |
|
|
|
return getLabelInRepoByID(x, repoID, labelID) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetLabelsInRepoByIDs returns a list of labels by IDs in given repository,
|
|
|
|
// GetLabelsInRepoByIDs returns a list of labels by IDs in given repository,
|
|
|
|
// it silently ignores label IDs that are not belong to the repository.
|
|
|
|
// it silently ignores label IDs that do not belong to the repository.
|
|
|
|
func GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error) { |
|
|
|
func GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error) { |
|
|
|
labels := make([]*Label, 0, len(labelIDs)) |
|
|
|
labels := make([]*Label, 0, len(labelIDs)) |
|
|
|
return labels, x. |
|
|
|
return labels, x. |
|
|
|