Transform Postgres array into JS array
Hey, I was wondering if there's a helper or something to transform Postgres arrays
{one, two}
into JS arrays ['one', 'two']
. Right I know the Postgres array is turned into a string when executing queries13 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm getting a string. Maybe is the fact that my column type is an enum array?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Seems I have to add a parser https://github.com/brianc/node-pg-types/issues/56#issuecomment-323223477
GitHub
ENUM ARRAY types get parsed as single string · Issue #56 · brianc/n...
Hi, I found that currently there is an issue with the way pg-types parses ENUM ARRAY column types. Currently the array is not parsed at all and a simple string is returned with the SQL array serial...
do you know how can I define the custom types with Kysely? 😅
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yep, I ended up doing
As using oid seems brittle, for any reason the id could change between dev and prod
As using oid seems brittle, for any reason the id could change between dev and prodYou mean the data type oid in
setTypeParser
?
Yeah, the custom type oid was different in my local db and prod db, idk why 🤷♂️ but better not to risk it
This can be more type-safe:
You're the best