summaryrefslogtreecommitdiffstats
path: root/models/db/context.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-10-31 23:51:14 +0800
committerGitHub <noreply@github.com>2022-10-31 23:51:14 +0800
commit9a70a12a341b8e7773efc661693e4b7e3199a4bd (patch)
tree2e4f3e18315ef52e68d4bfea5939d5517d3ca56b /models/db/context.go
parent4ae3f762177a2cdb449b949501420e88462f8f95 (diff)
downloadgitea-9a70a12a341b8e7773efc661693e4b7e3199a4bd.tar.gz
gitea-9a70a12a341b8e7773efc661693e4b7e3199a4bd.zip
Merge db.Iterate and IterateObjects (#21641)
These two functions are similiar, merge them.
Diffstat (limited to 'models/db/context.go')
-rw-r--r--models/db/context.go10
1 files changed, 0 insertions, 10 deletions
diff --git a/models/db/context.go b/models/db/context.go
index 4fd35200cf..e90780e4e9 100644
--- a/models/db/context.go
+++ b/models/db/context.go
@@ -8,9 +8,6 @@ import (
"context"
"database/sql"
- "code.gitea.io/gitea/modules/setting"
-
- "xorm.io/builder"
"xorm.io/xorm/schemas"
)
@@ -121,13 +118,6 @@ func WithTx(f func(ctx context.Context) error, stdCtx ...context.Context) error
return sess.Commit()
}
-// Iterate iterates the databases and doing something
-func Iterate(ctx context.Context, tableBean interface{}, cond builder.Cond, fun func(idx int, bean interface{}) error) error {
- return GetEngine(ctx).Where(cond).
- BufferSize(setting.Database.IterateBufferSize).
- Iterate(tableBean, fun)
-}
-
// Insert inserts records into database
func Insert(ctx context.Context, beans ...interface{}) error {
_, err := GetEngine(ctx).Insert(beans...)