Build Postgres Functions in Rust on Amazon RDS
aws.amazon.com
aws.amazon.com
the tldr is that you can write a function like this:
CREATE OR REPLACE FUNCTION public.array_sum(x float8[])
RETURNS float8
LANGUAGE plrust
IMMUTABLE PARALLEL SAFE STRICT
AS $$
let sum: f64 = x.iter()
.map(|&xi| (xi.unwrap()))
.sum();
Ok(Some(sum))
$$;
and everythign between the $$ is Rust code. This is obviously a bit more approachable for developers who don't like SQL, and doesn't have the performance penalty of something like plv8 (for computational-heavy functions at least)[0] https://aws.amazon.com/about-aws/whats-new/2023/05/amazon-rd...