:description "composable SQL queries"
:authors ["Z. D. Smith <firstname.lastname@example.org>"]
# doozer: composable SQL queries for Janet
*This software is currently Alpha quality and in heavy development!*
Doozer is a library, inspired by Elixir's [Ecto][ecto], which provides the
ability to write SQL queries using a convenient, idiomatic Janet DSL, which
are highly composable---that is, doozer produces data structures which should
be easy to combine in order to create new SQL queries.
Currently supported features:
- SQL function calls
- Raw SQL fragments
Currently supported backends:
The basic flow of a doozer query is:
1. Construct a query out of one or more calls to the `from` macro
2. Render that into concrete SQL using the function `to-sql`
3. Evaluate the SQL using the library associated with a specific database
For instance, here's an entire session using SQLite:
(def db (sqlite3/open "chinook.db"))
(def q (from "artists" a :select [name]))
(def sql-and-params (to-sql q))
Doozer has multiple backends available, which will output SQL compatible with
a specific SQL database.
To configure doozer, set the dynamic variable `:doozer/sql-backend` to point
to the correct value.
Backend modules also expose a `config!` convenience function which will set
the variable for you. For instance:
Doozer queries are agnostic of any backend; however, `doozer/to-sql` will
error if no backend is set.
:source ["doozer.janet" "doozer"])