mirror of https://github.com/jackc/pgx.git
DateCodec.DecodeValue can return pgtype.InfinityModifier
Previously, an infinite value was returned as a string. Other types that can be infinite such as Timestamptz return a pgtype.InfinityModifier. This change brings them into alignment.pull/1379/head
parent
29109487ec
commit
071d1c9467
|
@ -336,16 +336,9 @@ func (c DateCodec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (an
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if date.Valid {
|
||||
switch date.InfinityModifier {
|
||||
case Finite:
|
||||
return date.Time, nil
|
||||
case Infinity:
|
||||
return "infinity", nil
|
||||
case NegativeInfinity:
|
||||
return "-infinity", nil
|
||||
}
|
||||
if date.InfinityModifier != Finite {
|
||||
return date.InfinityModifier, nil
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
return date.Time, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue