Files
bux-lang/apps/simpledb
dimgigov 53b43b0f79 feat: lifetime elision, tooling CI, registry, and LSP locals
Ship the QUALITY_PLAN stretch from ownership through ecosystem: C.1
lifetime elision (bootstrap + selfhost), bux fmt/test/doc CI hooks,
stdlib goldens, package registry (bux search/add), and LSP 0.4
position-sensitive locals with inferred let types. Full-tree format
pass plus Map/Set remove double-free fix.
2026-07-19 16:35:08 +03:00
..

SimpleDB

File-backed key-value database for Bux.

Usage

simpledb <dbfile> set <key> <value>
simpledb <dbfile> get <key>
simpledb <dbfile> del <key>
simpledb <dbfile> has <key>
simpledb <dbfile> keys
simpledb <dbfile> count

Examples

$ simpledb data.db set name BuxLang
OK  name = BuxLang

$ simpledb data.db set version 0.1.0
OK  version = 0.1.0

$ simpledb data.db get name
BuxLang

$ simpledb data.db has name
true  name

$ simpledb data.db keys
keys: 2
  name
  version

$ simpledb data.db count
count: 2

$ simpledb data.db del version
DEL version

$ cat data.db
name=BuxLang

Storage

Data is stored as plain text, one key=value per line. The file is created automatically on first write.

Build

# workaround: disable broken JWT module
mv ../../lib/crypto/jwt.bux ../../lib/crypto/jwt.bux.bak
../../buxc build
mv ../../lib/crypto/jwt.bux.bak ../../lib/crypto/jwt.bux

API

The Database struct and its functions are defined in src/Main.bux and can be imported into other Bux projects:

import Simpledb::{Database, DB_New, DB_Load, DB_Save, DB_Get, DB_Set, DB_Del, DB_Has, DB_Count, DB_Keys};
Function Signature
DB_New (path: String) -> Database
DB_Load (db: *Database) -> bool
DB_Save (db: *Database) -> bool
DB_Get (db: *Database, key: String) -> String
DB_Set (db: *Database, key: String, value: String)
DB_Del (db: *Database, key: String) -> bool
DB_Has (db: *Database, key: String) -> bool
DB_Count (db: *Database) -> uint
DB_Keys (db: *Database) -> *String