#libsql #udf #wasm #sqlite

macro libsql_bindgen_macros

Rust macros for writing WebAssembly-powered user-defined functions for libSQL

3 releases

0.2.4 Nov 18, 2022
0.2.3 Nov 14, 2022
0.2.0 Nov 2, 2022

#19 in #libsql

21 downloads per month
Used in libsql_bindgen

MIT/Apache

7KB
100 lines

Intro

This repository contains a helper library for coding WebAssembly-powered user-defined functions for libSQL.

Marking a native Rust function with #[libsql_bindgen] macro and compiling it to wasm32-unknown-unknown target is enough to produce a user-defined function definition callable directly from libSQL.

A generic example: https://github.com/psarna/libsql_bindgen/blob/master/examples/encrypt_decrypt/src/lib.rs

Try it yourself:

cd examples/encrypt_decrypt
./get_sql.sh encrypt
./get_sql.sh decrypt

There are also advanced examples that require WasmEdge to run:

This repository is the foundation of libSQL generate and http://bindgen.libsql.org/

Dependencies

~1.5MB
~34K SLoC