From 97c01fb52451c10e686fb847ad390338bf1799ae Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 17 Mar 2017 08:06:00 -0500 Subject: [PATCH] Update docs for 2.10.0 release --- CHANGELOG.md | 4 +++- README.md | 2 +- doc.go | 14 +++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 126baef4..124274f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Unreleased +# 2.10.0 (March 17, 2017) ## Fixes @@ -16,10 +16,12 @@ * Add named error ErrAcquireTimeout (Alexander Staubo) * Add logical replication decoding (Kris Wehner) * Add PgxScanner interface to allow types to simultaneously support database/sql and pgx (Jack Christensen) +* Add CopyFrom with schema support (Jack Christensen) ## Compatibility * 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) diff --git a/README.md b/README.md index 63e4e797..97931c85 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Pgx supports many additional features beyond what is available through database/ * Transaction isolation level control * Full TLS connection control * 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 * Configurable connection pool with after connect hooks to do arbitrary connection setup * PostgreSQL array to Go slice mapping for integers, floats, and strings diff --git a/doc.go b/doc.go index 2b735bd5..f527d11d 100644 --- a/doc.go +++ b/doc.go @@ -214,23 +214,23 @@ creates a transaction with a specified isolation level. Copy Protocol -Use CopyTo to efficiently insert multiple rows at a time using the PostgreSQL -copy protocol. CopyTo accepts a CopyToSource interface. If the data is already -in a [][]interface{} use CopyToRows to wrap it in a CopyToSource interface. Or -implement CopyToSource to avoid buffering the entire data set in memory. +Use CopyFrom to efficiently insert multiple rows at a time using the PostgreSQL +copy protocol. CopyFrom accepts a CopyFromSource interface. If the data is already +in a [][]interface{} use CopyFromRows to wrap it in a CopyFromSource interface. Or +implement CopyFromSource to avoid buffering the entire data set in memory. rows := [][]interface{}{ {"John", "Smith", int32(36)}, {"Jane", "Doe", int32(29)}, } - copyCount, err := conn.CopyTo( + copyCount, err := conn.CopyFrom( "people", []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