Another question. Why valueList and other similar functions support only primitive values?
Is TypeScript a reason? The thing I like about pg driver is that, unlike MySQL, I can SELECT or INSERT a date, a boolean, an object, etc. value an it will do "the right thing" without an extra hassle.
Maybe it's not entirely safe or somehow "not a good practice" – I dunno.
For now, the API feels limiting for no obvious reason.
Value token can be any primitive that is shared between pg and JavaScript (string, integer, float, boolean, null).
If you have a requirement for automatic coalescing of other object types (such as Date), I suggest raising an issue. I cannot think of other types that would be relatively safe to cast, though.
Another question. Why
valueList
and other similar functions support only primitive values?Is TypeScript a reason? The thing I like about
pg
driver is that, unlike MySQL, I canSELECT
orINSERT
a date, a boolean, an object, etc. value an it will do "the right thing" without an extra hassle.Maybe it's not entirely safe or somehow "not a good practice" – I dunno.
For now, the API feels limiting for no obvious reason.
Value token can be any primitive that is shared between pg and JavaScript (string, integer, float, boolean, null).
If you have a requirement for automatic coalescing of other object types (such as Date), I suggest raising an issue. I cannot think of other types that would be relatively safe to cast, though.
JS Object with
JSON.stringify
?Too many edges cases where an object could be passed accidentally inserting potentially sensitive data to the database.
There is
sql.json()
for that, though.