RFC: template system for Postgres

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема RFC: template system for Postgres
Дата
Msg-id 54F7F687.1030800@BlueTreble.com
обсуждение исходный текст
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Postgresql CIFS
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Weight BLOB objects in postgreSQL? How?