Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
ic-rusqlite
This is a convenience package to create a canister with the Sqlite support.
Prerequisites
It is assumed that you have rust, dfx.
To compile a project with this dependency, you will need to:
- install wasi2ic:
cargo install wasi2ic - install WASI target:
rustup target add wasm32-wasip1
Using Precompiled SQLite
If you don't want to install WASI-SDK, you can use the precompiled SQLite version for WASI, just activate the precompiled feature and disable the default features:
Compiling SQLite
If you intend to compile the SQLite from the source, you will need to install WASI-SDK:
- install WASI-SDK and WASI-oriented clang: WASI-SDK.
- set the
WASI_SDK_PATHandPATHvariables:
You can automate this by launching the preparation script:
|
Finally, to enable rusqlite in your canister, add the helper dependency into your backend canister:
Developing Canister
You will need to update the dfx.json and specify path to wasm, set type to custom, and
specify custom build steps to enforce compilation to the wasm32-wasip1 target.
Finally, use wasi2ic to produce wasm executable on the Internet Computer.
Example:
Example
Use the with_connection() function to access your database:
//...
with_connection
//...
Further Examples
- A minimal example is available in the
"examples/backend"folder. - Also see the demo Svelte canister.
For more detailed explanations, see the ic-rusqlite book.