2020-07-26 17:09:05 +08:00
|
|
|
package postgres
|
|
|
|
|
|
|
|
|
|
import (
|
2021-09-12 16:15:42 +08:00
|
|
|
// imports the driver, don't remove this comment, golint requires.
|
2020-07-26 17:09:05 +08:00
|
|
|
_ "github.com/lib/pq"
|
2022-01-04 15:51:32 +08:00
|
|
|
"github.com/zeromicro/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
|
|
|
}
|