Add command line parameter to purspgpp

This commit is contained in:
rightfold 2016-12-22 20:28:47 +01:00
parent 001bdeb8c9
commit 4128b03e2b
2 changed files with 13 additions and 16 deletions

11
PurspgppExample.purs Normal file
View File

@ -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)|]

View File

@ -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)|]