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 to implement method on domain #54

Closed akmalhazim closed 3 years ago

akmalhazim commented 3 years ago

Hello, May I know how to add hooks to our domain struct? Considering it is swappable, how can I add a hook to any of the domain struct for example using BeforeCreate (gorm hook). Thank you

bxcodec commented 3 years ago

Hi!

It's not domain responsibility to manage it. It should be on the repository layer. ORM is considered a repository layer. You can use databases with/without ORM in repository layer.

I'm closing this issue. Thanks!