diff --git a/models/db/search.go b/models/db/search.go index ebb8eef227..f5273cb6f6 100644 --- a/models/db/search.go +++ b/models/db/search.go @@ -3,12 +3,6 @@ package db -import ( - "context" - - "xorm.io/builder" -) - // SearchOrderBy is used to sort the result type SearchOrderBy string @@ -33,15 +27,3 @@ const ( SearchOrderByForks SearchOrderBy = "num_forks ASC" SearchOrderByForksReverse SearchOrderBy = "num_forks DESC" ) - -// FindObjects represents a common function to find Objects from database according cond and ListOptions -func FindObjects[Object any](ctx context.Context, cond builder.Cond, opts *ListOptions, objects *[]*Object) error { - sess := GetEngine(ctx).Where(cond) - if opts != nil && opts.PageSize > 0 { - if opts.Page < 1 { - opts.Page = 1 - } - sess.Limit(opts.PageSize, opts.PageSize*(opts.Page-1)) - } - return sess.Find(objects) -}