diff options
author | Unknwon <u@gogs.io> | 2015-12-05 01:09:14 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-05 01:09:14 -0500 |
commit | f41360d864bfa3fb850d669a0a8321820fc550de (patch) | |
tree | 5450285739bd0be98258474f45d62991dd1429ee /models/admin.go | |
parent | e82ee40e9e667797099edc05ec1b774f65310464 (diff) | |
download | gitea-f41360d864bfa3fb850d669a0a8321820fc550de.tar.gz gitea-f41360d864bfa3fb850d669a0a8321820fc550de.zip |
#2052 advanced select ops for system notices
Diffstat (limited to 'models/admin.go')
-rw-r--r-- | models/admin.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/models/admin.go b/models/admin.go index f2ddf11efa..1d6bf62961 100644 --- a/models/admin.go +++ b/models/admin.go @@ -5,9 +5,12 @@ package models import ( + "strings" "time" "github.com/Unknwon/com" + + "github.com/gogits/gogs/modules/base" ) type NoticeType int @@ -18,7 +21,7 @@ const ( // Notice represents a system notice for admin. type Notice struct { - Id int64 + ID int64 `xorm:"pk autoincr"` Type NoticeType Description string `xorm:"TEXT"` Created time.Time `xorm:"CREATED"` @@ -71,3 +74,12 @@ func DeleteNotices(start, end int64) error { _, err := sess.Delete(new(Notice)) return err } + +// DeleteNoticesByIDs deletes notices by given IDs. +func DeleteNoticesByIDs(ids []int64) error { + if len(ids) == 0 { + return nil + } + _, err := x.Where("id IN (" + strings.Join(base.Int64sToStrings(ids), ",") + ")").Delete(new(Notice)) + return err +} |