word: database module to connect to postgres
[sheet.git] / tools / mkwordlist
index e1729a380bf99b624bc1369e0d3633a14f9d1d4a..4f9c70386905400025a3e4839e76b90d9d976f6d 100755 (executable)
@@ -1,5 +1,13 @@
-#!/bin/sh
-echo 'use utf8;'
-psql sheet -XAt -c "
-       SELECT json_object_agg(coalesce(id::text, ''), forms) FROM _cat_words
-" | sed 's/ : / => /g'
+#!/usr/bin/env perl
+use 5.014;
+use warnings;
+
+BEGIN { push @INC, '.' }
+use Shiar_Sheet::DB;
+use open ':std' => ':utf8';
+my $db = Shiar_Sheet::DB->connect;
+
+say 'use utf8;';
+
+use Data::Dump 'pp';
+say pp { $db->select(_cat_words => "coalesce(id::text, ''), forms")->map };