Update line wrapping in docs

pull/1281/head
Jack Christensen 2022-07-23 07:04:23 -05:00
parent a5b4f888c2
commit 7c81972938
1 changed files with 8 additions and 6 deletions

14
doc.go
View File

@ -55,7 +55,8 @@ pgx implements Query and Scan in the familiar database/sql style.
// No errors found - do something with sum // No errors found - do something with sum
ForEachRow can be used to execute a callback function for every row. This is often easier than iterating over rows directly. ForEachRow can be used to execute a callback function for every row. This is often easier than iterating over rows
directly.
var sum, n int32 var sum, n int32
rows, _ := conn.Query(context.Background(), "select generate_series(1,$1)", 10) rows, _ := conn.Query(context.Background(), "select generate_series(1,$1)", 10)
@ -164,9 +165,10 @@ is recommended that this situation be avoided by implementing pgx interfaces on
Composite types and row values Composite types and row values
Row values and composite types are represented as pgtype.Record (https://pkg.go.dev/github.com/jackc/pgtype?tab=doc#Record). Row values and composite types are represented as pgtype.Record
It is possible to get values of your custom type by implementing DecodeBinary interface. Decoding into (https://pkg.go.dev/github.com/jackc/pgtype?tab=doc#Record). It is possible to get values of your custom type by
pgtype.Record first can simplify process by avoiding dealing with raw protocol directly. implementing DecodeBinary interface. Decoding into pgtype.Record first can simplify process by avoiding dealing with raw
protocol directly.
For example: For example:
@ -259,8 +261,8 @@ for information on how to customize or disable the statement cache.
Copy Protocol Copy Protocol
Use CopyFrom to efficiently insert multiple rows at a time using the PostgreSQL copy protocol. CopyFrom accepts a 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 [][]any use CopyFromRows to wrap it in a CopyFromSource CopyFromSource interface. If the data is already in a [][]any use CopyFromRows to wrap it in a CopyFromSource interface.
interface. Or implement CopyFromSource to avoid buffering the entire data set in memory. Or implement CopyFromSource to avoid buffering the entire data set in memory.
rows := [][]any{ rows := [][]any{
{"John", "Smith", int32(36)}, {"John", "Smith", int32(36)},