diff options
Diffstat (limited to 'models/admin.go')
-rw-r--r-- | models/admin.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/admin.go b/models/admin.go index e24e0026b8..f2ddf11efa 100644 --- a/models/admin.go +++ b/models/admin.go @@ -61,3 +61,13 @@ func DeleteNotice(id int64) error { _, err := x.Id(id).Delete(new(Notice)) return err } + +// DeleteNotices deletes all notices with ID from start to end (inclusive). +func DeleteNotices(start, end int64) error { + sess := x.Where("id >= ?", start) + if end > 0 { + sess.And("id <= ?", end) + } + _, err := sess.Delete(new(Notice)) + return err +} |