larzdb
Crash-safe single-file database.
A log-structured embedded database in one file: CRC-checked frames with fsync-on-commit, torn-tail recovery on replay, JSON document collections, a query language, indexes and atomic transactions.
larzscript pkg install db
What you get
- Log-structured, crash-safe
- JSON collections + query language
- Secondary indexes & transactions
- One file, zero setup
Try it
import "db" as db
let path = "app.dblog"
remove(path)
let d = db.open(path)
let id = db.insert(d, "users", {"name": "Ada"})
db.create_index(d, "users", "name")
print(db.find_by(d, "users", "name", "Ada"))
db.transaction(d, fn(tx) {
db.insert(tx, "users", {"name": "Bo"})
db.insert(tx, "users", {"name": "Cy"})
})
print(len(db.all(d, "users")))
remove(path)Output
[{name: Ada}]
3Why it's in the Larz Stack
larzdb is a real Larzscript package (larzscript pkg install db) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.