plv8ify
plv8ify copied to clipboard
Share your use cases
How are you using/experimenting with plv8ify
?
Here is mine: https://trackfootball.app/blog/engineering/typescript-in-postgres-with-plv8
I'm using plv8ify to implement AWS request signing as a Postgres function. This allows applications built using no-code API tools such as postgrest, postgraphile, and hasura to easily generate upload/download urls for assets on S3.
@easel curious, how did you get access to the AWS resources from Postgres server?
@divyenduz there's no need to access resources on the postgres server. The signing function generates usable pre-signed urls via select queries, which can be used by a client application running in a browser to directly load those resources.
Hi!
I'm trying to enforce types with zod. Pity, so far it chokes at
export const collection = <T>(t: z.ZodSchema<T> = z.any()) => z.object({ items: z.array(t) })
export type Collection<T> = z.infer<ReturnType<typeof collection<T>>>
DEBUG: Running in node runtime
✘ [ERROR] Expected ">" but found "<"
generated-deno/common-protocol.types.ts:24:66:
24 │ export type Collection<T> = z.infer<ReturnType<typeof collection<T>>>
│ ^
╵ >
Wonder if the fix is a low-hanging fruit?
@dvv can you please create a separate issue here: https://github.com/divyenduz/plv8ify/issues/new with steps to reproduce. Are you using deno? I am afraid that's not supported yet! I can take a look soon
@divyenduz sure, #37
I am trying to find an easier path to write postgres backend code in a json heavy data model database. Pgpsql has primitives to handle json fields /structures, but it is painful, and simple operations like a map/foreach or spread operations involve a lot of code gymnastics, all of which with no type safety. Also, debugging pgpsql code is a royal pain To that end we're building a prototype that uses graphile worker (https://github.com/graphile/worker) to allow quick development and testing of typescript based postgres functions (with local debugger capabilities) and plv8ify to 'convert' the functions to backend code once they have been vetted and tested