From 5472ce9f10de431102fe221e76384392ea90f771 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 15 Jan 2022 18:45:42 -0600 Subject: [PATCH] Reorder Box functions --- pgtype/box.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pgtype/box.go b/pgtype/box.go index 677d4bd2..80e1bd19 100644 --- a/pgtype/box.go +++ b/pgtype/box.go @@ -144,23 +144,6 @@ func (BoxCodec) PlanScan(ci *ConnInfo, oid uint32, format int16, target interfac return nil } -func (c BoxCodec) DecodeDatabaseSQLValue(ci *ConnInfo, oid uint32, format int16, src []byte) (driver.Value, error) { - return codecDecodeToTextFormat(c, ci, oid, format, src) -} - -func (c BoxCodec) DecodeValue(ci *ConnInfo, oid uint32, format int16, src []byte) (interface{}, error) { - if src == nil { - return nil, nil - } - - var box Box - err := codecScan(c, ci, oid, format, src, &box) - if err != nil { - return nil, err - } - return box, nil -} - type scanPlanBinaryBoxToBoxScanner struct{} func (scanPlanBinaryBoxToBoxScanner) Scan(ci *ConnInfo, oid uint32, formatCode int16, src []byte, dst interface{}) error { @@ -236,3 +219,20 @@ func (scanPlanTextAnyToBoxScanner) Scan(ci *ConnInfo, oid uint32, formatCode int return scanner.ScanBox(Box{P: [2]Vec2{{x1, y1}, {x2, y2}}, Valid: true}) } + +func (c BoxCodec) DecodeDatabaseSQLValue(ci *ConnInfo, oid uint32, format int16, src []byte) (driver.Value, error) { + return codecDecodeToTextFormat(c, ci, oid, format, src) +} + +func (c BoxCodec) DecodeValue(ci *ConnInfo, oid uint32, format int16, src []byte) (interface{}, error) { + if src == nil { + return nil, nil + } + + var box Box + err := codecScan(c, ci, oid, format, src, &box) + if err != nil { + return nil, err + } + return box, nil +}