mirror of https://github.com/jackc/pgx.git
DateCodec.DecodeDatabaseSQLValue returns time.Time when possible
Previously it returned a string. However, this was an unintended
behavior change from pgx v4.
89f69aaea9 (commitcomment-89173737)
pull/1379/head
parent
daf570c752
commit
29109487ec
|
@ -308,7 +308,21 @@ func (scanPlanTextAnyToDateScanner) Scan(src []byte, dst any) error {
|
|||
}
|
||||
|
||||
func (c DateCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {
|
||||
return codecDecodeToTextFormat(c, m, oid, format, src)
|
||||
if src == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var date Date
|
||||
err := codecScan(c, m, oid, format, src, &date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if date.InfinityModifier != Finite {
|
||||
return date.InfinityModifier.String(), nil
|
||||
}
|
||||
|
||||
return date.Time, nil
|
||||
}
|
||||
|
||||
func (c DateCodec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) {
|
||||
|
|
Loading…
Reference in New Issue