From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | RFC: template system for Postgres |
Date: | 2015-03-05 06:24:07 |
Message-ID: | 54F7F687.1030800@BlueTreble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I've sketched out a design for a templating system for Postgres, and I'm
looking for feedback from anyone that might be interested in it.
My goal is to allow people to register different template languages in
it (anything that can be loaded in a Postgres procedure language would
work), and allow storing named templates. My personal desire for this is
to support a meta-programming system for Postgres [1], but I expect most
people would want to use it for things like email or report templates.
In a scenario like that, you might do something like:
-- Store a template email to send to new users
SELECT trunklet.template__store(
'template language'
, 'new user email'
, '<template goes here'
);
-- Get emails to send to all new users
SELECT trunklet.process( 'new user email', array[['first_name',
first_name],['last_name',last_name])
FROM user
WHERE welcome_email_sent_on IS NULL
;
The API documentation is at
https://github.com/decibel/trunklet/blob/master/doc/trunklet.asc.
[1] https://github.com/decibel/pg_classy/blob/master/doc/pg_classy.asc
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2015-03-05 06:55:53 | Re: Weight BLOB objects in postgreSQL? How? |
Previous Message | John R Pierce | 2015-03-05 06:22:29 | Re: Postgresql CIFS |