Files
go-zero/core/stores/postgres/postgresql.go

15 lines
381 B
Go
Raw Normal View History

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"
"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
// 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
}