Hi,
Not an Issue but Question
Thanks for setting up the repo, it actually clears the picture of clean code practices. I have one doubt what if there are multiple controllers suppose in controller folder there are multiple files regarding users, books, clients etc, so In order to setup DB connection do we need to have base Handler in each and every file?
`// BaseHandler will hold everything that controller needs
type BaseHandler struct {
db *sql.DB
}
// NewBaseHandler returns a new BaseHandler
func NewBaseHandler(db *sql.DB) *BaseHandler {
return &BaseHandler{
db: db,
}
}`
if yes? won't be it too redundant to using the same piece of code again and again?
Once again Thanks for the Repo, it cleared my too many doubts already.
Hi,
Not an Issue but Question
Thanks for setting up the repo, it actually clears the picture of clean code practices. I have one doubt what if there are multiple controllers suppose in controller folder there are multiple files regarding users, books, clients etc, so In order to setup DB connection do we need to have base Handler in each and every file?
`// BaseHandler will hold everything that controller needs
type BaseHandler struct {
db *sql.DB
}
// NewBaseHandler returns a new BaseHandler
func NewBaseHandler(db *sql.DB) *BaseHandler {
return &BaseHandler{
db: db,
}
}`
if yes? won't be it too redundant to using the same piece of code again and again?
Once again Thanks for the Repo, it cleared my too many doubts already.