Add a client option for handling dates as strings in @effect/sql-pg
and @effect/sql-mysql2
#4476
Labels
enhancement
New feature or request
What is the problem this feature would solve?
Working with dates often presents the challenge of converting between
string
s andDate
objects (i.e., serializing and deserializing).The following shows the default implementation of date-related types in the
postgres
package: https://github.com/porsager/postgres/blob/089214e85c23c90cf142d47fb30bd03f42874984/src/types.js#L28-L33Ref: https://discord.com/channels/795981131316985866/1134177528098078861/1341711841147093086
What is the feature you are proposing to solve the problem?
Add an option to handle this scenario directly with
PgClient
andMySqlClient
.In the MySQL package, we can simply expose
dateStrings
sincemysql2
supports it.In the Pg package, we could add a new option that sets or merges
types
accordingly. I was considering usingSchema
as it seems natural, but I'd appreciate another perspective.What alternatives have you considered?
When working with
PgClient
, declare thetypes
configuration as:or by selecting the field with
::text
, although this is not feasible when using*
.Source: porsager/postgres#161 (comment)
The text was updated successfully, but these errors were encountered: