feat: hel: render without execute

This commit is contained in:
2025-04-19 20:02:10 +00:00
parent 10a0a08dcd
commit 2229cf072b
13 changed files with 359 additions and 88 deletions

26
package/c/hel/hel--0.1.sql Executable file
View File

@@ -0,0 +1,26 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION hel" to load this file. \quit
CREATE SCHEMA hel;
-- Define the parse_text_with_hectic function that uses hectic library
-- Expected usage:
-- ```sql
-- SELECT "hel"."render"(
-- "declare" :=
-- jsonb_build_object(
-- 'name', 'test',
-- 'config', jsonb_build_object(
-- 'debug', true,
-- 'limit', 100
-- )
-- ),
-- "template" := $hel$
-- {{ name }} {{ config.limit }}
-- $hel$
-- );
-- ```
CREATE FUNCTION "hel"."render"("declare" json, "template" text)
RETURNS text
AS 'hel', 'render'
LANGUAGE C STRICT;