| Crates.io | ic-dbms-client |
| lib.rs | ic-dbms-client |
| version | 0.3.0 |
| created_at | 2025-12-11 19:36:55.098203+00 |
| updated_at | 2025-12-24 16:48:54.937173+00 |
| description | ic-dbms-canister client library for interacting with the ic-dbms-canister. |
| homepage | |
| repository | https://github.com/veeso/ic-dbms |
| max_upload_size | |
| id | 1980422 |
| size | 107,563 |

This crate exposes all the types which may be used by an external canister to interact with an IC DBMS Canister instance.
All the client methods can be accessed through the Client trait.
The crate provides an implementation of the client for IC DBMS Canister, called IcDbmsCanisterClient,
which can be used on ic canisters.
If you want to use the client in integration tests with pocket-ic, you can use the
IcDbmsPocketIcClient implementation, but first you need to enable the pocket-ic feature.
[dependencies]
candid = "0.10"
ic-dbms-api = "0.1"
ic-dbms-client = "0.1"
serde = "1"
You can define your table as you did for the database, or use a common crate to share the types between the canisters.
use candid::{CandidType, Principal};
use ic_dbms_api::prelude::{Nullable, Query, Table, TableSchema, Text, Uint32, Uint64};
use ic_dbms_client::prelude::{Client as _, IcDbmsCanisterClient};
use serde::Deserialize;
#[derive(Table, CandidType, Clone, Deserialize)]
#[table = "users"]
pub struct User {
#[primary_key]
id: Uint64,
name: Text,
email: Text,
age: Nullable<Uint32>,
}
let principal = Principal::from_text("...")?;
let client = IcDbmsCanisterClient::new(principal);
let alice = UserInsertRequest {
id: 1.into(),
name: "Alice".into(),
email: "alice@example.com".into(),
age: Nullable::Value(30.into()),
};
client
.insert::<User>(User::table_name(), alice, None)
.await?;
IcDbmsCanisterClient: Client implementation for IC canisters.IcDbmsPocketIcClient: Client implementation for pocket-ic integration tests.All the client methods are defined in the Client trait.
acl_add_principalacl_remove_principalacl_allowed_principalsbegin_transactioncommitrollbackselectinsertupdatedeleteYou can import all the useful types and traits by using the prelude module:
use ic_dbms_client::prelude::*;
This project is licensed under the MIT License. See the LICENSE file for details.