summaryrefslogtreecommitdiffstats
path: root/models/update.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-24 03:36:47 -0400
committerUnknwon <u@gogs.io>2015-10-24 03:36:47 -0400
commit0fbb8c8826771e92e890fb1c72b356d3e62c7b01 (patch)
tree2695707e4789a6611fa35393b06631848657469a /models/update.go
parente0aab4a7f6c1f1b5cc7fa40e2c09623b635bc4a6 (diff)
downloadgitea-0fbb8c8826771e92e890fb1c72b356d3e62c7b01.tar.gz
gitea-0fbb8c8826771e92e890fb1c72b356d3e62c7b01.zip
New push to head repo of head branch: regenerate patch and retest apply
Diffstat (limited to 'models/update.go')
-rw-r--r--models/update.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/models/update.go b/models/update.go
index 645b58c4c5..0cf62db418 100644
--- a/models/update.go
+++ b/models/update.go
@@ -16,11 +16,11 @@ import (
)
type UpdateTask struct {
- Id int64
- Uuid string `xorm:"index"`
+ ID int64 `xorm:"pk autoincr"`
+ UUID string `xorm:"index"`
RefName string
- OldCommitId string
- NewCommitId string
+ OldCommitID string
+ NewCommitID string
}
func AddUpdateTask(task *UpdateTask) error {
@@ -28,20 +28,21 @@ func AddUpdateTask(task *UpdateTask) error {
return err
}
-func GetUpdateTasksByUuid(uuid string) ([]*UpdateTask, error) {
+func GetUpdateTaskByUUID(uuid string) (*UpdateTask, error) {
task := &UpdateTask{
- Uuid: uuid,
+ UUID: uuid,
}
- tasks := make([]*UpdateTask, 0)
- err := x.Find(&tasks, task)
+ has, err := x.Get(task)
if err != nil {
return nil, err
+ } else if !has {
+ return nil, fmt.Errorf("task does not exist: %s", uuid)
}
- return tasks, nil
+ return task, nil
}
-func DelUpdateTasksByUuid(uuid string) error {
- _, err := x.Delete(&UpdateTask{Uuid: uuid})
+func DeleteUpdateTaskByUUID(uuid string) error {
+ _, err := x.Delete(&UpdateTask{UUID: uuid})
return err
}