question: combine all ids into one row and execute as one query it's better way?

Author: fr11nikCreated Jun 23, 2024Updated Jun 23, 2024

https://github.com/bxcodec/go-clean-arch/blob/e06c6d0cb37069b0ef56e3df67f80ca130a1ab82/article/service.go#L63 in

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
}