func (t *DbConnection) Connect() (return type) {
dbTest, err := sql.Open("postgres", "user = praveen dbname = test_twichblade sslmode = disable")
return dbTest
}
In above example what should be the return type ?
func (t *DbConnection) Connect() (return type) {
dbTest, err := sql.Open("postgres", "user = praveen dbname = test_twichblade sslmode = disable")
return dbTest
}
In above example what should be the return type ?
Open function returns (*DB, error), so you should return *sql.DB
func Open(driverName, dataSourceName string) (*DB, error)
func (t *DbConnection) Connect() (*sql.DB) {
dbTest, err := sql.Open("postgres", "user = praveen dbname = test_twichblade sslmode = disable")
return dbTest
}