Skip to content

v0.1.0

Choose a tag to compare

@mpyw mpyw released this 18 Aug 13:40
· 25 commits to main since this release
720aa55

The first release of bisql — a two-way SQL template engine for Go.

Directives are written as SQL comments, so a template is valid SQL a client can run as-is, while an application converts the same text into a parameterized statement (SQL, Args).

Highlights

  • Explicit model — the renderer emits the template verbatim, evaluating only directives and stripping parser comments. No implicit clause/connector removal, no whitespace normalization; the author anchors dynamic fragments (1 = 1 / a leading connector).
  • Directives — bind (/* */), inline literal (/*^ */), conditional (/*%if/elseif/else/end*/), iteration (/*%for*/), and @include for reusable fragments (recursive, cycle-guarded).
  • Bind expansion by test-literal shape — a parenthesized test expands an iterable into an IN-list; a scalar test binds a slice as one array parameter (PostgreSQL = ANY(...)).
  • Dialects — MySQL, SQLite, PostgreSQL, Oracle, SQL Server (placeholder generation + literal formatting).
  • Loaders — RegistryLoader, FSLoader, LoaderFunc, StackedLoader; ParseFile/ExpandFile over any fs.FS.
  • Reviewable output — Statement.SQLWithArgs() renders a values-embedded form on demand (review only, never execute).

See the README for the directive reference and authoring rules, and pkg.go.dev for the API and runnable examples.

go get github.com/mpyw/bisql@v0.1.0