plv8ify icon indicating copy to clipboard operation
plv8ify copied to clipboard

Share your use cases

Open divyenduz opened this issue 2 years ago • 7 comments

How are you using/experimenting with plv8ify?

Here is mine: https://trackfootball.app/blog/engineering/typescript-in-postgres-with-plv8

divyenduz avatar Mar 10 '22 22:03 divyenduz

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 avatar Mar 16 '22 21:03 easel

@easel curious, how did you get access to the AWS resources from Postgres server?

divyenduz avatar Oct 26 '22 18:10 divyenduz

@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.

easel avatar Oct 26 '22 18:10 easel

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 avatar Dec 16 '23 16:12 dvv

@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 avatar Dec 17 '23 00:12 divyenduz

@divyenduz sure, #37

dvv avatar Dec 17 '23 05:12 dvv

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

mattiarossi avatar Dec 29 '23 15:12 mattiarossi