2
0

pgtype DecodeText and DecodeBinary do not copy

They now take ownership of the src argument.

Needed to change Scan to make a copy of []byte arguments as lib/pq apparently
gives Scan a shared memory buffer.
This commit is contained in:
Jack Christensen
2017-04-29 12:23:51 -05:00
parent e8eaad520b
commit 932caef600
57 changed files with 188 additions and 93 deletions
+4 -4
View File
@@ -96,15 +96,15 @@ type Value interface {
type BinaryDecoder interface {
// DecodeBinary decodes src into BinaryDecoder. If src is nil then the
// original SQL value is NULL. BinaryDecoder MUST not retain a reference to
// src. It MUST make a copy if it needs to retain the raw bytes.
// original SQL value is NULL. BinaryDecoder takes ownership of src. The
// caller MUST not use it again.
DecodeBinary(ci *ConnInfo, src []byte) error
}
type TextDecoder interface {
// DecodeText decodes src into TextDecoder. If src is nil then the original
// SQL value is NULL. TextDecoder MUST not retain a reference to src. It MUST
// make a copy if it needs to retain the raw bytes.
// SQL value is NULL. TextDecoder takes ownership of src. The caller MUST not
// use it again.
DecodeText(ci *ConnInfo, src []byte) error
}