fix(db): make paginated database reads always require "order" option (#39017)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwindandwxiaoguang authored and GitHub committed 2026-08-23 08:18:18 +00:00
1 parent 0bed1232ee
commit 1c16f04bf5
29 files changed
+161 -65

No files matched your search

+4
View File
@@ -75,6 +75,10 @@ type FindGPGKeyOptions struct {
IncludeSubKeys bool
}
func (opts FindGPGKeyOptions) ToOrders() string {
return "id"
}
func (opts FindGPGKeyOptions) ToConds() builder.Cond {
cond := builder.NewCond()
if !opts.IncludeSubKeys {
+4
View File
@@ -184,6 +184,10 @@ type FindPublicKeyOptions struct {
LoginSourceID int64
}
func (opts FindPublicKeyOptions) ToOrders() string {
return "id"
}
func (opts FindPublicKeyOptions) ToConds() builder.Cond {
cond := builder.NewCond()
if opts.OwnerID > 0 {
+4
View File
@@ -158,6 +158,10 @@ type ListDeployKeysOptions struct {
Fingerprint string
}
func (opt ListDeployKeysOptions) ToOrders() string {
return "name"
}
func (opt ListDeployKeysOptions) ToConds() builder.Cond {
cond := builder.NewCond()
cond = cond.And(builder.Eq{"repo_id": opt.RepoID}) // repo ID must be used