forked from kevadesu/forgejo
Merge db.Iterate and IterateObjects (#21641)
These two functions are similiar, merge them.
This commit is contained in:
parent
4ae3f76217
commit
9a70a12a34
12 changed files with 77 additions and 51 deletions
|
@ -18,10 +18,9 @@ import (
|
|||
func iterateUserAccounts(ctx context.Context, each func(*user.User) error) error {
|
||||
err := db.Iterate(
|
||||
ctx,
|
||||
new(user.User),
|
||||
builder.Gt{"id": 0},
|
||||
func(idx int, bean interface{}) error {
|
||||
return each(bean.(*user.User))
|
||||
func(ctx context.Context, bean *user.User) error {
|
||||
return each(bean)
|
||||
},
|
||||
)
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue