Different Ways to Pass Database Connection into Controllers in Golang

In Golang, one can pass the database connection to the controller as a global variable or by creating a separate struct or by creating a repository interface and passing it to the controller.