Bisql can generate typical index-friendly CRUD SQL from the database schema.
Depending on table structure and indexes, generated SQL commonly includes:
insertinsert-manyget-by-*listlist-by-*countcount-by-*update-by-*delete-by-*upsert-by-*The generated SQL is intended to cover the repetitive queries that usually follow:
The goal is not to hide SQL. The goal is to generate the SQL you would usually write by hand anyway.
That means:
Generated upserts use PostgreSQL ON CONFLICT ... DO UPDATE.
Bisql also supports generated update policy control via:
:inserting:non-updating-colsThis allows templates such as:
SET status = /*%if non-updating-cols.status */ t.status /*%else => EXCLUDED.status */ /*%end */
In practice:
:inserting lists the values you want to provide for the insert path:non-updating-cols names columns that should be used on insert, but should not be updated on conflictWhen a column is listed in :non-updating-cols, the generated upsert keeps the
existing table value on DO UPDATE instead of taking the value from
EXCLUDED. A typical example is created_at, which is usually set on insert
but should remain unchanged on later updates.
bisql.edngen-cruddefquerySee also:
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |