feat: static page for fun
This commit is contained in:
16
flake.nix
16
flake.nix
@@ -439,20 +439,20 @@
|
|||||||
};
|
};
|
||||||
nativeBuildInputs = with prev; [pkg-config curl];
|
nativeBuildInputs = with prev; [pkg-config curl];
|
||||||
};
|
};
|
||||||
buildHelExt = versionSuffix: let
|
buildHemarExt = versionSuffix: let
|
||||||
postgresql = prev."postgresql_${versionSuffix}";
|
postgresql = prev."postgresql_${versionSuffix}";
|
||||||
c-hectic = self.packages.${prev.system}.c-hectic;
|
c-hectic = self.packages.${prev.system}.c-hectic;
|
||||||
in buildPostgresqlExtension {
|
in buildPostgresqlExtension {
|
||||||
inherit postgresql;
|
inherit postgresql;
|
||||||
} {
|
} {
|
||||||
pname = "hel";
|
pname = "hemar";
|
||||||
version = "0.1";
|
version = "0.1";
|
||||||
src = ./package/c/hel;
|
src = ./package/c/hemar;
|
||||||
nativeBuildInputs = (with prev; [pkg-config]) ++ [ c-hectic ];
|
nativeBuildInputs = (with prev; [pkg-config]) ++ [ c-hectic ];
|
||||||
dontShrinkRPath = true;
|
dontShrinkRPath = true;
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
echo ">>> postFixup running..."
|
echo ">>> postFixup running..."
|
||||||
${prev.patchelf}/bin/patchelf --set-rpath ${c-hectic}/lib $out/lib/hel.so
|
${prev.patchelf}/bin/patchelf --set-rpath ${c-hectic}/lib $out/lib/hemar.so
|
||||||
'';
|
'';
|
||||||
preInstall = ''mkdir $out'';
|
preInstall = ''mkdir $out'';
|
||||||
};
|
};
|
||||||
@@ -462,25 +462,25 @@
|
|||||||
http = buildHttpExt "17";
|
http = buildHttpExt "17";
|
||||||
pg_smtp_client = buildSmtpExt "17";
|
pg_smtp_client = buildSmtpExt "17";
|
||||||
plhaskell = buildPlHaskellExt "17";
|
plhaskell = buildPlHaskellExt "17";
|
||||||
hel = buildHelExt "17";
|
hemar = buildHemarExt "17";
|
||||||
};};
|
};};
|
||||||
postgresql_16 = prev.postgresql_16 // {pkgs = prev.postgresql_16.pkgs // {
|
postgresql_16 = prev.postgresql_16 // {pkgs = prev.postgresql_16.pkgs // {
|
||||||
http = buildHttpExt "16";
|
http = buildHttpExt "16";
|
||||||
pg_smtp_client = buildSmtpExt "16";
|
pg_smtp_client = buildSmtpExt "16";
|
||||||
plhaskell = buildPlHaskellExt "16";
|
plhaskell = buildPlHaskellExt "16";
|
||||||
hel = buildHelExt "16";
|
hemar = buildHemarExt "16";
|
||||||
};};
|
};};
|
||||||
postgresql_15 = prev.postgresql_15 // {pkgs = prev.postgresql_15.pkgs // {
|
postgresql_15 = prev.postgresql_15 // {pkgs = prev.postgresql_15.pkgs // {
|
||||||
http = buildHttpExt "15";
|
http = buildHttpExt "15";
|
||||||
pg_smtp_client = buildSmtpExt "15";
|
pg_smtp_client = buildSmtpExt "15";
|
||||||
plhaskell = buildPlHaskellExt "15";
|
plhaskell = buildPlHaskellExt "15";
|
||||||
hel = buildHelExt "15";
|
hemar = buildHemarExt "15";
|
||||||
};};
|
};};
|
||||||
postgresql_14 = prev.postgresql_14 // {pkgs = prev.postgresql_14.pkgs // {
|
postgresql_14 = prev.postgresql_14 // {pkgs = prev.postgresql_14.pkgs // {
|
||||||
http = buildHttpExt "14";
|
http = buildHttpExt "14";
|
||||||
pg_smtp_client = buildSmtpExt "14";
|
pg_smtp_client = buildSmtpExt "14";
|
||||||
plhaskell = buildPlHaskellExt "14";
|
plhaskell = buildPlHaskellExt "14";
|
||||||
hel = buildHelExt "14";
|
hemar = buildHemarExt "14";
|
||||||
};};
|
};};
|
||||||
writers = let
|
writers = let
|
||||||
writeC =
|
writeC =
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
2
package/c/hemar/.gitignore
vendored
Executable file
2
package/c/hemar/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
hemar.o
|
||||||
|
hemar.so
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
MODULE_big = hel
|
MODULE_big = hemar
|
||||||
OBJS = hel.o
|
OBJS = hemar.o
|
||||||
EXTENSION = hel
|
EXTENSION = hemar
|
||||||
|
|
||||||
DATA = $(wildcard *.sql)
|
DATA = $(wildcard *.sql)
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||||
\echo Use "CREATE EXTENSION hel" to load this file. \quit
|
\echo Use "CREATE EXTENSION hemar" to load this file. \quit
|
||||||
|
|
||||||
CREATE SCHEMA hel;
|
CREATE SCHEMA hemar;
|
||||||
|
|
||||||
-- Define the parse_text_with_hectic function that uses hectic library
|
-- Define the parse_text_with_hectic function that uses hectic library
|
||||||
-- Expected usage:
|
-- Expected usage:
|
||||||
-- ```sql
|
-- ```sql
|
||||||
-- SELECT "hel"."render"(
|
-- SELECT "hemar"."render"(
|
||||||
-- "declare" :=
|
-- "declare" :=
|
||||||
-- jsonb_build_object(
|
-- jsonb_build_object(
|
||||||
-- 'name', 'test',
|
-- 'name', 'test',
|
||||||
@@ -15,12 +15,12 @@ CREATE SCHEMA hel;
|
|||||||
-- 'limit', 100
|
-- 'limit', 100
|
||||||
-- )
|
-- )
|
||||||
-- ),
|
-- ),
|
||||||
-- "template" := $hel$
|
-- "template" := $hemar$
|
||||||
-- {{ name }} {{ config.limit }}
|
-- {{ name }} {{ config.limit }}
|
||||||
-- $hel$
|
-- $hemar$
|
||||||
-- );
|
-- );
|
||||||
-- ```
|
-- ```
|
||||||
CREATE FUNCTION "hel"."render"("declare" json, "template" text)
|
CREATE FUNCTION "hemar"."render"("declare" json, "template" text)
|
||||||
RETURNS text
|
RETURNS text
|
||||||
AS 'hel', 'render'
|
AS 'hemar', 'render'
|
||||||
LANGUAGE C STRICT;
|
LANGUAGE C STRICT;
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
PG_MODULE_MAGIC;
|
PG_MODULE_MAGIC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Helper function to get a JSON value by key path */
|
/* helper function to get a JSON value by key path */
|
||||||
static Json *json_get_by_path(Arena *arena, const Json *context, const char *key_path) {
|
static Json *json_get_by_path(Arena *arena, const Json *context, const char *key_path) {
|
||||||
|
|
||||||
char *path_copy;
|
char *path_copy;
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
comment = 'My first extension'
|
comment = 'My first extension'
|
||||||
default_version = '0.1'
|
default_version = '0.1'
|
||||||
module_pathname = '$libdir/hel'
|
module_pathname = '$libdir/hemar'
|
||||||
@@ -93,11 +93,11 @@ case "$MODE" in
|
|||||||
HECTIC_LIB="$HECTIC_PATH/lib"
|
HECTIC_LIB="$HECTIC_PATH/lib"
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
gcc $CFLAGS $OPTFLAGS -I$PG_INCLUDE -I$HECTIC_INCLUDE -shared -o target/hel.so hel.c -L$HECTIC_LIB -lhectic
|
gcc $CFLAGS $OPTFLAGS -I$PG_INCLUDE -I$HECTIC_INCLUDE -shared -o target/hemar.so hemar.c -L$HECTIC_LIB -lhectic
|
||||||
|
|
||||||
# Copy extension files to target directory
|
# Copy extension files to target directory
|
||||||
cp hel.control target/
|
cp hemar.control target/
|
||||||
cp hel--0.1.sql target/
|
cp hemar--0.1.sql target/
|
||||||
|
|
||||||
echo "Build complete. Files available in target/ directory."
|
echo "Build complete. Files available in target/ directory."
|
||||||
;;
|
;;
|
||||||
Reference in New Issue
Block a user