/aos-sqlite

AOS Module built with LUA and SQLite

Primary LanguageC

AOS-SQLite

AOS-SQLite combines the ao operating system module and sqlite to create an ao custom module to add a lightweight but powerful indexer to your aos experience.

The bulk of this effort was done by @elliotsayes during the Hack the Weave competition, Elliot was able to create this WASM Binary that includes both SQLite, LUA, and aos, as an ao Module.

AOS-SQLite Module - ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw

Run a SQLite Database with AOS(WASM64)

aos my-sqlite --module=ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw

Run a SQLite Database with AOS(WASM32)

aos my-sqlite --module=GYrbbe0VbHim_7Hi6zrOpHQXrSQz07XNtwCnfbFo2I0

Spawn via a process

Spawn('ghSkge2sIUD_F00ym5sEimC63BDBuBrq4b5OcwxOjiw', { Data = "Hello SQLite Wasm64" })

Examples

local sqlite3 = require("lsqlite3")
 
db = sqlite3.open_memory()
  
db:exec[[
  CREATE TABLE test (id INTEGER PRIMARY KEY, content);
  INSERT INTO test VALUES (NULL, 'Hello Lua');
  INSERT INTO test VALUES (NULL, 'Hello Sqlite3');
  INSERT INTO test VALUES (NULL, 'Hello ao!!!');
]]
return "ok"
local s = ""
 
for row in db:nrows("SELECT * FROM test") do
  s = s .. row.id .. ": " .. row.content .. "\\n"
end
 
return s

AO Resources


This project builds the AOS-SQLITE WASM Binary and Publishes it to Arweave.

Build Process

  1. Build docker image
cd container
./build.sh
  1. Get Latest aos module
git submodule init
git submodule update --remote
  1. Use docker image to compile process.wasm
cd aos/process
docker run -v .:/src p3rmaw3b/ao emcc-lua
  1. Publish Module with tags via arkb

You will need a funded wallet for this step

export WALLET=~/.wallet.json
npm run deploy