I'm having trouble understanding the best way to organize an application dependency structure in golang.
Essentially, my application is structured like this:
accounts
...
handlers
accounts.go
models
account.go
repos
account.go
Now I have a database access object (DAO) setup for accounts and I would like to avoid putting validation logic in there because that fits the model domain better. Repos are designed to only handle interaction with the database.
Inside of models, I believe it makes sense to put validations. However, one validation such as the uniqueness of the email, requires using the DAO which throws an error about circular deps.
I'm curious what is the best way to organize validations in this paradigm? Should I really include a service layer for any interaction at all? That is, should I have a model that is just the struct for the Account and then have validations and before save hooks in the service?