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
+10 -10
View File
@@ -142,14 +142,14 @@ func (encodePlanUint32CodecBinaryInt64Valuer) Encode(value interface{}, buf []by
return nil, nil
}
if v.Int < 0 {
return nil, fmt.Errorf("%d is less than minimum value for uint32", v.Int)
if v.Int64 < 0 {
return nil, fmt.Errorf("%d is less than minimum value for uint32", v.Int64)
}
if v.Int > math.MaxUint32 {
return nil, fmt.Errorf("%d is greater than maximum value for uint32", v.Int)
if v.Int64 > math.MaxUint32 {
return nil, fmt.Errorf("%d is greater than maximum value for uint32", v.Int64)
}
return pgio.AppendUint32(buf, uint32(v.Int)), nil
return pgio.AppendUint32(buf, uint32(v.Int64)), nil
}
type encodePlanUint32CodecTextUint32 struct{}
@@ -186,14 +186,14 @@ func (encodePlanUint32CodecTextInt64Valuer) Encode(value interface{}, buf []byte
return nil, nil
}
if v.Int < 0 {
return nil, fmt.Errorf("%d is less than minimum value for uint32", v.Int)
if v.Int64 < 0 {
return nil, fmt.Errorf("%d is less than minimum value for uint32", v.Int64)
}
if v.Int > math.MaxUint32 {
return nil, fmt.Errorf("%d is greater than maximum value for uint32", v.Int)
if v.Int64 > math.MaxUint32 {
return nil, fmt.Errorf("%d is greater than maximum value for uint32", v.Int64)
}
return append(buf, strconv.FormatInt(v.Int, 10)...), nil
return append(buf, strconv.FormatInt(v.Int64, 10)...), nil
}
func (Uint32Codec) PlanScan(m *Map, oid uint32, format int16, target interface{}) ScanPlan {