Skip to content

Commit

Permalink
add FindAll(user)
Browse files Browse the repository at this point in the history
  • Loading branch information
akiyatomohiro committed Jul 31, 2024
1 parent b34e28e commit 237f51a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions account/accountusecase/accountrepo/multiuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ func NewMultiUser(users ...User) MultiUser {

var _ User = MultiUser{}

func (u MultiUser) FindAll(ctx context.Context) (user.List, error) {
res := user.List{}
for _, r := range u {
if r, err := r.FindAll(ctx); err != nil {
return nil, err
} else {
res = append(res, r...)
}
}
return res, nil
}

func (u MultiUser) FindByID(ctx context.Context, id user.ID) (*user.User, error) {
return u.findOne(func(r User) (*user.User, error) {
return r.FindByID(ctx, id)
Expand Down

0 comments on commit 237f51a

Please sign in to comment.