mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
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)
This commit is contained in:
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) {
|
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) {
|
func (c DateCodec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user