diff --git a/PurspgppExample.purs b/PurspgppExample.purs new file mode 100644 index 0000000..3e9f600 --- /dev/null +++ b/PurspgppExample.purs @@ -0,0 +1,11 @@ +module PurspgppExample where + +f :: Query (String × Unit) (UUID × String × Unit) +f = [query| + SELECT id, name + FROM files + WHERE author_id = $1 +|] + +g :: Query Unit (Boolean × Unit) +g = [query|SELECT pg_try_advisory_lock(3735928559)|] diff --git a/purspgpp b/purspgpp index 2897782..780242a 100644 --- a/purspgpp +++ b/purspgpp @@ -75,21 +75,7 @@ sub process-query($conn, Str:D $source) { "(Query \"\"\"$source\"\"\" :: Query ($parameters) ($fields))"; } -sub MAIN { +sub MAIN(IO(Cool) $filename) { my $conn = libpq::Connection.new("user=postgres password=lol123 dbname=nn"); - - print process-module($conn, $=finish); + print process-module($conn, $filename.slurp); } - -=finish -module M where - -f :: Query (String × Unit) (UUID × String × Unit) -f = [query| - SELECT id, name - FROM files - WHERE author_id = $1 -|] - -g :: Query Unit (Boolean × Unit) -g = [query|SELECT pg_try_advisory_lock(3735928559)|]