|
|
@ -103,10 +103,10 @@ func NewLabels(labels ...*Label) error { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// getLabelInRepoByID returns a label by ID in given repository.
|
|
|
|
// getLabelOfRepoByID returns a label by ID in given repository.
|
|
|
|
// If pass repoID as 0, then ORM will ignore limitation of repository
|
|
|
|
// If pass repoID as 0, then ORM will ignore limitation of repository
|
|
|
|
// and can return arbitrary label with any valid ID.
|
|
|
|
// and can return arbitrary label with any valid ID.
|
|
|
|
func getLabelInRepoByID(e Engine, repoID, labelID int64) (*Label, error) { |
|
|
|
func getLabelOfRepoByID(e Engine, repoID, labelID int64) (*Label, error) { |
|
|
|
if labelID <= 0 { |
|
|
|
if labelID <= 0 { |
|
|
|
return nil, ErrLabelNotExist{labelID, repoID} |
|
|
|
return nil, ErrLabelNotExist{labelID, repoID} |
|
|
|
} |
|
|
|
} |
|
|
@ -126,12 +126,12 @@ func getLabelInRepoByID(e Engine, repoID, labelID int64) (*Label, error) { |
|
|
|
|
|
|
|
|
|
|
|
// GetLabelByID returns a label by given ID.
|
|
|
|
// GetLabelByID returns a label by given ID.
|
|
|
|
func GetLabelByID(id int64) (*Label, error) { |
|
|
|
func GetLabelByID(id int64) (*Label, error) { |
|
|
|
return getLabelInRepoByID(x, 0, id) |
|
|
|
return getLabelOfRepoByID(x, 0, id) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetLabelInRepoByID returns a label by ID in given repository.
|
|
|
|
// GetLabelOfRepoByID returns a label by ID in given repository.
|
|
|
|
func GetLabelInRepoByID(repoID, labelID int64) (*Label, error) { |
|
|
|
func GetLabelOfRepoByID(repoID, labelID int64) (*Label, error) { |
|
|
|
return getLabelInRepoByID(x, repoID, labelID) |
|
|
|
return getLabelOfRepoByID(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,
|
|
|
@ -181,7 +181,7 @@ func UpdateLabel(l *Label) error { |
|
|
|
|
|
|
|
|
|
|
|
// DeleteLabel delete a label of given repository.
|
|
|
|
// DeleteLabel delete a label of given repository.
|
|
|
|
func DeleteLabel(repoID, labelID int64) error { |
|
|
|
func DeleteLabel(repoID, labelID int64) error { |
|
|
|
_, err := GetLabelInRepoByID(repoID, labelID) |
|
|
|
_, err := GetLabelOfRepoByID(repoID, labelID) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if IsErrLabelNotExist(err) { |
|
|
|
if IsErrLabelNotExist(err) { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|