You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
李光春
c1b53452eb
|
2 years ago | |
---|---|---|
.. | ||
LICENSE | 2 years ago | |
README.md | 2 years ago | |
column.go | 2 years ago | |
config.go | 2 years ago | |
copy.go | 2 years ago | |
driver.go | 2 years ago | |
error.go | 2 years ago | |
format.go | 2 years ago | |
listener.go | 2 years ago | |
proto.go | 2 years ago | |
safe.go | 2 years ago | |
unsafe.go | 2 years ago | |
write_buffer.go | 2 years ago |
README.md
pgdriver
pgdriver is a database/sql driver for PostgreSQL based on go-pg code.
You can install it with:
go get github.com/uptrace/bun/driver/pgdriver
And then create a sql.DB
using it:
import _ "github.com/uptrace/bun/driver/pgdriver"
dsn := "postgres://postgres:@localhost:5432/test"
db, err := sql.Open("pg", dsn)
Alternatively:
dsn := "postgres://postgres:@localhost:5432/test"
db := sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(dsn)))
BenchmarkInsert/pg-12 7254 148380 ns/op 900 B/op 13 allocs/op
BenchmarkInsert/pgx-12 6494 166391 ns/op 2076 B/op 26 allocs/op
BenchmarkSelect/pg-12 9100 132952 ns/op 1417 B/op 18 allocs/op
BenchmarkSelect/pgx-12 8199 154920 ns/op 3679 B/op 60 allocs/op
See documentation for more details.