Files
sqlite3/README.md
2022-01-27 11:41:20 +01:00

40 lines
990 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# sqlite3
is a simple high-level wrapper around SQLite3. It doesnt intend to wrap
everything, but it tries to be useful.
## Installation
```clojure
(load "git@git.veitheller.de:carpentry/sqlite3.git@0.0.6")
```
## Usage
The module `SQLite3` provides facilities for opening, closing, and querying
databases.
```clojure
(load "git@git.veitheller.de:carpentry/sqlite3.git@0.0.6")
; opening DBs can fail, for the purposes of this example we
; ignore that
(let-do [db (Result.unsafe-from-success (SQLite3.open "db"))]
; we can prepare statements
(println* &(SQLite3.query &db "INSERT INTO mytable VALUES (?1, ?2);"
&[(to-sqlite3 @"hello") (to-sqlite3 100)]))
; and query things
(println* &(SQLite3.query &db "SELECT * from mytable;" &[]))
(SQLite3.close db)
```
Because `open` and `query` return `Result` types, we could also use
combinators!
For more information, check out [the
documentation](https://veitheller.de/sqlite3)!
<hr/>
Have fun!