Janet bindings for CozoDB, an embeddable Datalog database.
(import cozo)
(let [db (cozo/open "test.db")
rows (cozo/q db "?[] <- [['hello', 'world', 'Cozo!']]")]
(printf "Found %d row(s)" (length rows))
(each row rows
(pp row))
(cozo/close db))
As an alternative to querying with CozoScript, there is also an experimental quasiquote syntax. See test
for more examples.
(import cozo)
(let [db (cozo/open "test.db")
rows (cozo/q db ~(? [] <- [["hello", "world", "Cozo!"]]))]
(printf "Found %d row(s)" (length rows))
(each row rows
(pp row))
(cozo/close db))
Build links $JANET_BUILDPATH/release/libcozo_c.a
if present, otherwise builds from source using the cozo
git submodule.