From 80ae29d056efafc02740defe9358c0f8c6b1721b Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Tue, 4 Jan 2022 19:56:16 -0600 Subject: [PATCH] Inline Encoder interface to Codec --- pgtype/pgtype.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pgtype/pgtype.go b/pgtype/pgtype.go index 5e924e1b..db706369 100644 --- a/pgtype/pgtype.go +++ b/pgtype/pgtype.go @@ -177,13 +177,6 @@ type ResultDecoder interface { DecodeResult(ci *ConnInfo, oid uint32, format int16, src []byte) error } -type Encoder interface { - // Encode appends the encoded bytes of value to buf. If value is the SQL NULL then append nothing and return - // (nil, nil). The caller of Encode is responsible for writing the correct NULL value or the length of the data - // written. - Encode(ci *ConnInfo, oid uint32, format int16, value interface{}, buf []byte) (newBuf []byte, err error) -} - type Codec interface { // FormatSupported returns true if the format is supported. FormatSupported(int16) bool @@ -191,7 +184,10 @@ type Codec interface { // PreferredFormat returns the preferred format. PreferredFormat() int16 - Encoder + // Encode appends the encoded bytes of value to buf. If value is the SQL NULL then append nothing and return + // (nil, nil). The caller of Encode is responsible for writing the correct NULL value or the length of the data + // written. + Encode(ci *ConnInfo, oid uint32, format int16, value interface{}, buf []byte) (newBuf []byte, err error) // PlanScan returns a ScanPlan for scanning a PostgreSQL value into a destination with the same type as target. If // actualTarget is true then the returned ScanPlan may be optimized to directly scan into target. If no plan can be