2
0

pgtype Int2, Int4, and Int8 fields include bit size

e.g. Instead of Int it is Int64. This matches the pattern set by the
database/sql types.
This commit is contained in:
Jack Christensen
2022-03-05 09:10:58 -06:00
parent 872a7a9315
commit d723a4ab6f
12 changed files with 206 additions and 206 deletions
+3 -3
View File
@@ -324,7 +324,7 @@ func (encodePlanNumericCodecBinaryInt64Valuer) Encode(value interface{}, buf []b
return nil, nil
}
return encodeNumericBinary(Numeric{Int: big.NewInt(n.Int), Valid: true}, buf)
return encodeNumericBinary(Numeric{Int: big.NewInt(n.Int64), Valid: true}, buf)
}
func encodeNumericBinary(n Numeric, buf []byte) (newBuf []byte, err error) {
@@ -476,7 +476,7 @@ func (encodePlanNumericCodecTextInt64Valuer) Encode(value interface{}, buf []byt
return nil, nil
}
return encodeNumericText(Numeric{Int: big.NewInt(n.Int), Valid: true}, buf)
return encodeNumericText(Numeric{Int: big.NewInt(n.Int64), Valid: true}, buf)
}
func encodeNumericText(n Numeric, buf []byte) (newBuf []byte, err error) {
@@ -682,7 +682,7 @@ func (scanPlanBinaryNumericToInt64Scanner) Scan(src []byte, dst interface{}) err
return fmt.Errorf("%v is out of range for int64", bigInt)
}
return scanner.ScanInt64(Int8{Int: bigInt.Int64(), Valid: true})
return scanner.ScanInt64(Int8{Int64: bigInt.Int64(), Valid: true})
}
type scanPlanTextAnyToNumericScanner struct{}