Closed djanatyn closed 2 years ago
postgres::types::Date<chrono::NaiveDate>
.
The date enum handles the infinity values that Postgres supports but Rust date types typically do not. If you aren't using infinite date values in your database you should just use chrono::NaiveDate
directly.
Thank you, that explains it!
Today while pair-programming, we had a postgres database with a
date
column. We were trying to usepostgres::row::Row#get
withpostgres::types::Date
:At first we were confused by what
T
should be, and triedi32
:That didn't end up working (sorry, don't have the error message), so we switched to using the
with-chrono-0_4
feature, and returnedchrono::NaiveDate
instead:I was wondering:
postgres::types::Date
with the postgresdate
type in this context? I couldn't find any examples of usage, or any associated tests.postgres::types::Date
, what is the meaning of the<T>
parameter? For a regular postgresdate
column, what shouldT
be?Thank you for your time!