我正在使用带有golang的postgres数据库,并且尝试返回连接对象,但是我不知道返回类型的连接对象

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
}

According to https://golang.org/pkg/database/sql/#Open
sql.Open returns *DB, error, so you should return *sql.DB in your case.
You can use this information https://golang.org/pkg/database/sql/ about databse/sql package