mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-30 12:16:14 -06:00
| .. | ||
| column.go | ||
| config.go | ||
| driver.go | ||
| error.go | ||
| format.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| listener.go | ||
| proto.go | ||
| README.md | ||
| safe.go | ||
| unsafe.go | ||
| write_buffer.go | ||
pgdriver
pgdriver is a database/sql driver for PostgreSQL based on go-pg code.
You can install it with:
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