2
0

Update Rows.Scan documentation to reflect reality.

Previously, the Scan documentation stated that scanning into a []byte
will skip the decoding process and directly copy the raw bytes received
from PostgreSQL.

This has not been true for at least 2 months. It is also undesirable
behavior in some cases such as a binary formatted jsonb. In that case
the '1' prefix needs to be stripped to have valid JSON. If the raw
bytes are desired this can easily be accomplished by scanning into
pgtype.GenericBinary or using Rows.RawValues.

In light of the fact that the new behavior is superior, and that it has
been in place for a significant amount of time, I have decided to
document the new behavior rather than change back to the old behavior.
This commit is contained in:
Jack Christensen
2020-09-05 11:19:51 -05:00
parent 5b06f03d0a
commit 2ec377350b
4 changed files with 48 additions and 3 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ require (
github.com/jackc/pgconn v1.6.5-0.20200821030840-fdfc783345f6
github.com/jackc/pgio v1.0.0
github.com/jackc/pgproto3/v2 v2.0.4
github.com/jackc/pgtype v1.4.2
github.com/jackc/pgtype v1.4.3-0.20200905161353-e7d2b057a716
github.com/jackc/puddle v1.1.2-0.20200821025810-91d0159cc97a
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/rs/zerolog v1.15.0