mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-26 07:53:29 +00:00
fix(db): make paginated database reads always require "order" option (#39017)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -43,6 +43,10 @@ type FindCollaborationOptions struct {
|
||||
CollaboratorID int64
|
||||
}
|
||||
|
||||
func (opts *FindCollaborationOptions) ToOrders() string {
|
||||
return "collaboration.id"
|
||||
}
|
||||
|
||||
func (opts *FindCollaborationOptions) ToConds() builder.Cond {
|
||||
cond := builder.NewCond()
|
||||
if opts.RepoID != 0 {
|
||||
|
||||
@@ -38,6 +38,10 @@ type PushMirrorOptions struct {
|
||||
RemoteName string
|
||||
}
|
||||
|
||||
func (opts PushMirrorOptions) ToOrders() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
func (opts PushMirrorOptions) ToConds() builder.Cond {
|
||||
cond := builder.NewCond()
|
||||
if opts.RepoID > 0 {
|
||||
@@ -100,6 +104,10 @@ type findPushMirrorOptions struct {
|
||||
SyncOnCommit optional.Option[bool]
|
||||
}
|
||||
|
||||
func (opts findPushMirrorOptions) ToOrders() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
func (opts findPushMirrorOptions) ToConds() builder.Cond {
|
||||
cond := builder.NewCond()
|
||||
if opts.RepoID > 0 {
|
||||
|
||||
@@ -27,6 +27,10 @@ type StarredReposOptions struct {
|
||||
Actor *user_model.User
|
||||
}
|
||||
|
||||
func (opts *StarredReposOptions) ToOrders() string {
|
||||
return "`repository`.id"
|
||||
}
|
||||
|
||||
func (opts *StarredReposOptions) ApplyPublicOnly(publicOnly bool) {
|
||||
if publicOnly {
|
||||
opts.IncludePrivate = false
|
||||
@@ -76,6 +80,10 @@ type WatchedReposOptions struct {
|
||||
Actor *user_model.User
|
||||
}
|
||||
|
||||
func (opts *WatchedReposOptions) ToOrders() string {
|
||||
return "`repository`.id"
|
||||
}
|
||||
|
||||
func (opts *WatchedReposOptions) ApplyPublicOnly(publicOnly bool) {
|
||||
if publicOnly {
|
||||
opts.IncludePrivate = false
|
||||
|
||||
Reference in New Issue
Block a user