aboutsummaryrefslogtreecommitdiffstats
path: root/models/release.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-02-03 16:47:04 +0800
committerGitHub <noreply@github.com>2020-02-03 09:47:04 +0100
commit48ce135cc9d54d1c5cf876411453414a53183968 (patch)
treee87064c6693e135d4732ba8c8289a267e560d985 /models/release.go
parente959d1a48baf6a59943949e0d6840e1512cd8934 (diff)
downloadgitea-48ce135cc9d54d1c5cf876411453414a53183968.tar.gz
gitea-48ce135cc9d54d1c5cf876411453414a53183968.zip
Move PushUpdateAddDeleteTags to repository module from models (#10106)
* Move PushUpdateAddDeleteTags to repository module from models * Fix deadlock on sqlite
Diffstat (limited to 'models/release.go')
-rw-r--r--models/release.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/models/release.go b/models/release.go
index ebd2b6d384..0f670f374f 100644
--- a/models/release.go
+++ b/models/release.go
@@ -119,9 +119,15 @@ func InsertRelease(rel *Release) error {
return err
}
+// InsertReleasesContext insert releases
+func InsertReleasesContext(ctx DBContext, rels []*Release) error {
+ _, err := ctx.e.Insert(rels)
+ return err
+}
+
// UpdateRelease updates all columns of a release
-func UpdateRelease(rel *Release) error {
- _, err := x.ID(rel.ID).AllCols().Update(rel)
+func UpdateRelease(ctx DBContext, rel *Release) error {
+ _, err := ctx.e.ID(rel.ID).AllCols().Update(rel)
return err
}
@@ -212,10 +218,10 @@ func GetReleasesByRepoID(repoID int64, opts FindReleasesOptions) ([]*Release, er
}
// GetReleasesByRepoIDAndNames returns a list of releases of repository according repoID and tagNames.
-func GetReleasesByRepoIDAndNames(repoID int64, tagNames []string) (rels []*Release, err error) {
- err = x.
- Desc("created_unix").
+func GetReleasesByRepoIDAndNames(ctx DBContext, repoID int64, tagNames []string) (rels []*Release, err error) {
+ err = ctx.e.
In("tag_name", tagNames).
+ Desc("created_unix").
Find(&rels, Release{RepoID: repoID})
return rels, err
}