question: combine all ids into one row and execute as one query it's better way?
Author: fr11nikCreated Jun 23, 2024Updated Jun 23, 2024
for authorID := range mapAuthors {
authorID := authorID
g.Go(func() error {
res, err := a.authorRepo.GetByID(ctx, authorID)
if err != nil {
return err
}
chanAuthor <- res
return nil
})
}better to do?
authors, err := a.authorRepo.GetByIDS(ctx, authorIDS)
if err != nil {
return err
}
for _, author := range authors {
chanAuthor <- res
}Source: bxcodec/go-clean-arch