Doc updates
This commit is contained in:
@@ -27,7 +27,7 @@ Pgx supports many additional features beyond what is available through database/
|
|||||||
* 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 protocol support for faster bulk data loads
|
||||||
* Logging support
|
* Extendable logging support including builtin support for log15 and logrus
|
||||||
* 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
|
||||||
* Hstore support
|
* Hstore support
|
||||||
|
|||||||
@@ -117,11 +117,11 @@ particular:
|
|||||||
|
|
||||||
Null Mapping
|
Null Mapping
|
||||||
|
|
||||||
pgx can map nulls in two ways. The first is Null* types that have a data field
|
pgx can map nulls in two ways. The first is package pgtype provides types that
|
||||||
and a valid field. They work in a similar fashion to database/sql. The second
|
have a data field and a null indicator field. They work in a similar fashion to
|
||||||
is to use a pointer to a pointer.
|
database/sql. The second is to use a pointer to a pointer.
|
||||||
|
|
||||||
var foo pgx.NullString
|
var foo pgtype.Varchar
|
||||||
var bar *string
|
var bar *string
|
||||||
err := conn.QueryRow("select foo, bar from widgets where id=$1", 42).Scan(&a, &b)
|
err := conn.QueryRow("select foo, bar from widgets where id=$1", 42).Scan(&a, &b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -133,13 +133,8 @@ Array Mapping
|
|||||||
pgx maps between int16, int32, int64, float32, float64, and string Go slices
|
pgx maps between int16, int32, int64, float32, float64, and string Go slices
|
||||||
and the equivalent PostgreSQL array type. Go slices of native types do not
|
and the equivalent PostgreSQL array type. Go slices of native types do not
|
||||||
support nulls, so if a PostgreSQL array that contains a null is read into a
|
support nulls, so if a PostgreSQL array that contains a null is read into a
|
||||||
native Go slice an error will occur.
|
native Go slice an error will occur. The pgtype package includes many more
|
||||||
|
array types for PostgreSQL types that do not directly map to native Go types.
|
||||||
Hstore Mapping
|
|
||||||
|
|
||||||
pgx includes an Hstore type and a NullHstore type. Hstore is simply a
|
|
||||||
map[string]string and is preferred when the hstore contains no nulls. NullHstore
|
|
||||||
follows the Null* pattern and supports null values.
|
|
||||||
|
|
||||||
JSON and JSONB Mapping
|
JSON and JSONB Mapping
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user