bxcodec / go-clean-arch

Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture
MIT License
9.06k stars 1.19k forks source link

How do we implement Bulk Update in this design pattern? #55

Closed akmalhazim closed 3 years ago

akmalhazim commented 3 years ago

Hi, May I know if there's a way for me to use any ORM update method without fetching the models first, right now from what I can see, the current pattern only allows the repository to update a single model. Is there any pattern that allows updating a single model and bulk update in one repository? image Thank you

bxcodec commented 3 years ago

Hi!

Actually, you can just add a bulk update on your contract. The service/Usecase layer is built based on the business need/logic. So if your application business logic needs to have a bulk update, then you just need to define it on the contract. Also how to define the contract on the Service layer or Repository layer, I recommend reading more about SOLID principles. That's should help you a lot to define the contract functions.

I'm closing this issue as this for a personal question.