Original post

So I have some code that looks something like this in the user_usecase.go file:

func (u *userUsecase) Activate(ctx context.Context, input model.ActivateAccountInput) (success bool, err error) {
user := u.repoOne.FindUser(ctx, input.Email) // some queries

hash := u.repoTwo.FindHash(ctx, input.Hash) // some additional queries

// Additional code

In my repo codes, I have methods that are reusable queries to the database, the problem that I have found with this approach is that, the Usecase has the potential to make duplicate database calls (for example, fetching users twice from the database, because the use case calls 2 methods that fetches the users, but does separate things). Sometimes I find myself making 10+ database calls for one Usecase method. Is there a better approach to this?