mirror of https://github.com/jackc/pgx.git
parent
2db04c3a02
commit
97c01fb524
|
@ -1,4 +1,4 @@
|
||||||
# Unreleased
|
# 2.10.0 (March 17, 2017)
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
|
@ -16,10 +16,12 @@
|
||||||
* Add named error ErrAcquireTimeout (Alexander Staubo)
|
* Add named error ErrAcquireTimeout (Alexander Staubo)
|
||||||
* Add logical replication decoding (Kris Wehner)
|
* Add logical replication decoding (Kris Wehner)
|
||||||
* Add PgxScanner interface to allow types to simultaneously support database/sql and pgx (Jack Christensen)
|
* Add PgxScanner interface to allow types to simultaneously support database/sql and pgx (Jack Christensen)
|
||||||
|
* Add CopyFrom with schema support (Jack Christensen)
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
* jsonb now defaults to binary format. This means passing a []byte to a jsonb column will no longer work.
|
* jsonb now defaults to binary format. This means passing a []byte to a jsonb column will no longer work.
|
||||||
|
* CopyTo is now deprecated but will continue to work.
|
||||||
|
|
||||||
# 2.9.0 (August 26, 2016)
|
# 2.9.0 (August 26, 2016)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ Pgx supports many additional features beyond what is available through database/
|
||||||
* Transaction isolation level control
|
* Transaction isolation level control
|
||||||
* Full TLS connection control
|
* Full TLS connection control
|
||||||
* Binary format support for custom types (can be much faster)
|
* Binary format support for custom types (can be much faster)
|
||||||
* Copy protocol support for faster bulk data loads
|
* Copy from protocol support for faster bulk data loads
|
||||||
* Logging support
|
* Logging support
|
||||||
* Configurable connection pool with after connect hooks to do arbitrary connection setup
|
* Configurable connection pool with after connect hooks to do arbitrary connection setup
|
||||||
* PostgreSQL array to Go slice mapping for integers, floats, and strings
|
* PostgreSQL array to Go slice mapping for integers, floats, and strings
|
||||||
|
|
14
doc.go
14
doc.go
|
@ -214,23 +214,23 @@ creates a transaction with a specified isolation level.
|
||||||
|
|
||||||
Copy Protocol
|
Copy Protocol
|
||||||
|
|
||||||
Use CopyTo to efficiently insert multiple rows at a time using the PostgreSQL
|
Use CopyFrom to efficiently insert multiple rows at a time using the PostgreSQL
|
||||||
copy protocol. CopyTo accepts a CopyToSource interface. If the data is already
|
copy protocol. CopyFrom accepts a CopyFromSource interface. If the data is already
|
||||||
in a [][]interface{} use CopyToRows to wrap it in a CopyToSource interface. Or
|
in a [][]interface{} use CopyFromRows to wrap it in a CopyFromSource interface. Or
|
||||||
implement CopyToSource to avoid buffering the entire data set in memory.
|
implement CopyFromSource to avoid buffering the entire data set in memory.
|
||||||
|
|
||||||
rows := [][]interface{}{
|
rows := [][]interface{}{
|
||||||
{"John", "Smith", int32(36)},
|
{"John", "Smith", int32(36)},
|
||||||
{"Jane", "Doe", int32(29)},
|
{"Jane", "Doe", int32(29)},
|
||||||
}
|
}
|
||||||
|
|
||||||
copyCount, err := conn.CopyTo(
|
copyCount, err := conn.CopyFrom(
|
||||||
"people",
|
"people",
|
||||||
[]string{"first_name", "last_name", "age"},
|
[]string{"first_name", "last_name", "age"},
|
||||||
pgx.CopyToRows(rows),
|
pgx.CopyFromRows(rows),
|
||||||
)
|
)
|
||||||
|
|
||||||
CopyTo can be faster than an insert with as few as 5 rows.
|
CopyFrom can be faster than an insert with as few as 5 rows.
|
||||||
|
|
||||||
Listen and Notify
|
Listen and Notify
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue