2020-07-26 17:09:05 +08:00
|
|
|
package postgres
|
|
|
|
|
|
|
|
|
|
import (
|
2021-02-09 13:50:21 +08:00
|
|
|
// imports the driver.
|
2020-07-26 17:09:05 +08:00
|
|
|
_ "github.com/lib/pq"
|
2020-08-08 16:40:10 +08:00
|
|
|
"github.com/tal-tech/go-zero/core/stores/sqlx"
|
2020-07-26 17:09:05 +08:00
|
|
|
)
|
|
|
|
|
|
2020-11-09 17:22:51 +08:00
|
|
|
const postgresDriverName = "postgres"
|
2020-07-26 17:09:05 +08:00
|
|
|
|
2021-02-28 23:02:49 +08:00
|
|
|
// New returns a postgres connection.
|
2021-02-07 15:27:01 +08:00
|
|
|
func New(datasource string, opts ...sqlx.SqlOption) sqlx.SqlConn {
|
2020-11-09 17:22:51 +08:00
|
|
|
return sqlx.NewSqlConn(postgresDriverName, datasource, opts...)
|
2020-07-26 17:09:05 +08:00
|
|
|
}
|