//+build wireinject package repository import ( "database/sql" "github.com/google/wire" "github.com/ollien/updown/config" ) // initDatabaseConnector is generated by wire. Please see wire_gen.go for the generated implementation func initDatabaseConnector() (*DatabaseConnector, error) { wire.Build(provideDatabaseConnector, config.Get) return nil, nil } func provideDatabaseConnector(appConfig config.Config) (*DatabaseConnector, error) { connection, err := sql.Open(driver, appConfig.DatabaseURI) if err != nil { return nil, err } return &DatabaseConnector{connection}, connection.Ping() }