Skip to content

Commit

Permalink
readme: showcase available feats
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-chavez committed Dec 4, 2023
1 parent cb1ce02 commit 9425c14
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,73 @@

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;
```

```psql
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;
```

```psql
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

```
Expand Down

0 comments on commit 9425c14

Please sign in to comment.