libsql_bindgen connects Rust functions to libSQL user-defined-function interfaces, simplifying custom Wasm functions that execute inside the database’s sandboxed environment. section 5.3.1
A typical Rust UDF project uses libsql_bindgen to:
- Create a Cargo library that produces a cdylib Wasm module. section 5.3.1
- Annotate exported Rust functions with the libsql_bindgen macro. section 5.3.1
- Limit parameters and return values to types compatible with Wasm and libSQL. section 5.3.1
Encryption and decryption UDFs
A Rust library can expose encrypt(data, key) and decrypt(data, key) functions with the #[libsql_bindgen::libsql_bindgen] attribute. These functions keep encryption logic inside the database, reducing the need to transfer unencrypted data elsewhere. section 5.3.1
