forked from forgejo/forgejo
Rewrite XORM queries
This commit is contained in:
parent
c040f2fbb1
commit
a4454f5d0f
22 changed files with 480 additions and 233 deletions
|
@ -103,7 +103,10 @@ func CountNotices() int64 {
|
|||
// Notices returns number of notices in given page.
|
||||
func Notices(page, pageSize int) ([]*Notice, error) {
|
||||
notices := make([]*Notice, 0, pageSize)
|
||||
return notices, x.Limit(pageSize, (page-1)*pageSize).Desc("id").Find(¬ices)
|
||||
return notices, x.
|
||||
Limit(pageSize, (page-1)*pageSize).
|
||||
Desc("id").
|
||||
Find(¬ices)
|
||||
}
|
||||
|
||||
// DeleteNotice deletes a system notice by given ID.
|
||||
|
@ -127,6 +130,8 @@ func DeleteNoticesByIDs(ids []int64) error {
|
|||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
_, err := x.Where("id IN (" + strings.Join(base.Int64sToStrings(ids), ",") + ")").Delete(new(Notice))
|
||||
_, err := x.
|
||||
Where("id IN (" + strings.Join(base.Int64sToStrings(ids), ",") + ")").
|
||||
Delete(new(Notice))
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue