Pure MoonBit reader for the SQLite 3 file format: pages, b-trees, records and rows, with no C dependency and no FFI.
let bytes = @fs.read_file("example.db") // any way you get the bytes
let db = @db.Database::open(bytes)
for table in db.tables() {
println(table.name) // columns, declared types, WITHOUT ROWID
for row in db.rows(table.name) {
println(row.rowid, row.values) // Value: Null, Int, Real, Text, Blob
}
}python3 tools/verify_sqlite.pymoon check --deny-warn --target all
moon test --target all --deny-warn
moon run cmd/main --target native -- schema example.db # page size, encoding, tables and columns
moon run cmd/main --target native -- dump example.db # one JSON line per row
moon run cmd/main --target native -- dump example.db --format csv # RFC 4180
moon run cmd/main --target native -- dump example.db --format sql # INSERT statements
moon run cmd/main --target native -- stats example.db # pages, free pages, user_version, rows per tableformat/ byte cursor, varints, serial types, record and text decoding
btree/ page headers, cell decoding, table b-tree traversal, overflow chains
schema/ sqlite_master scan and CREATE TABLE column parsing
db/ the public Database API
cmd/main/ the CLIInstall
Download zipPure MoonBit reader for the SQLite 3 file format: pages, b-trees, records and rows, with no C dependency and no FFI.