diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-02-03 16:47:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 09:47:04 +0100 |
commit | 48ce135cc9d54d1c5cf876411453414a53183968 (patch) | |
tree | e87064c6693e135d4732ba8c8289a267e560d985 /models/release.go | |
parent | e959d1a48baf6a59943949e0d6840e1512cd8934 (diff) | |
download | gitea-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.go | 16 |
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 } |