Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readme: showcase available feats
Browse files Browse the repository at this point in the history
steve-chavez committed Dec 4, 2023
1 parent cb1ce02 commit a85564b
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,69 @@

Logic-less templates for Postgres

## Roadmap

- [x] interpolation
- [x] sections
- [x] bools
- [ ] arrays
- [ ] partials
- [ ] inheritance
- [ ] lambdas

## Features

### Variables

```sql
create or replace function win_money(you text, qt money, at timestamptz) returns text as $$
Hello {{you}}!
You just won {{qt}} at {{at}}.
$$ language plmustache;

postgres=# select win_money('Slonik', '12000', now());
win_money
-----------------------------------------------------------
Hello Slonik! +
You just won $12,000.00 at 2023-12-04 07:44:26.915735-05.
(1 row)
```

### Sections

```sql
create or replace function show(show bool) returns text as $$
{{#show}}
This is a section showing, you see?
{{/show}}
{{^show}}
This is a section hiding, you see?
{{/show}}
$$ language plmustache;

postgres=# select show(true);
show
-------------------------------------
This is a section showing, you see?+

(1 row)

postgres=# select show(false);
show
------------------------------------
This is a section hiding, you see?+

(1 row)
```

## Installation

Install https://gitlab.com/jobol/mustach, then on this repo:

```
$ make && make install
```

## Development

```

0 comments on commit a85564b

Please sign in to comment.