Search Postgresql Archives

RFC: template system for Postgres

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux