top | item 36847026

(no title)

doliveira | 2 years ago

Yeah, I'm interested in knowing how people manage it. With Redis, I usually put the Lua code within the same repo and embed the Lua code within the deployment artifact, so it gets tested and deployed together with the rest of the code. Then I call SCRIPT LOAD at the application initialization and I get a SHA-1 hash to call the script.

At the very least, this approach makes things feel much safer. I would like to know if there better ways to do it, and if there are similar approaches for Postgres procedures.

discuss

order

claytongulick|2 years ago

I wrote this[1] several years ago to help with that.

It lets you write a function in nodejs that actually executes in plv8 inside the database.

To your project code though, it mostly looks like a normal js function (with some limitations).

Amongst other benefits, it allows you to manage your plv8 functions as a normal part of your repo.

[1]https://github.com/claytongulick/pgproxy