This project is an abstraction layer between the client and the p2panda node by providing tools to easily perform operations on a p2panda node.
In order to run this you first need to install aquadoggo
```sh git clone https://github.com/p2panda/aquadoggo.git
RUST_LOG=aquadoggo=info cargo run ```
The Operator
struct is the main wrapper around the p2panda library and the graphql layer.
To create a new Operator
use Operator::default()
or Operator::new()
.
Operator::default()
reads the ENDPOINT
environment variable, if is not present it uses http://localhost:2020/graphql
as default endpoint.
Run the following to test Zenode
(aquadoggo must be running in the background):
sh
cargo test
```rs use zenode::{field, Operator};
// create an Operator let op = Operator::default();
// create a schema let mut fields = vec![field("pokemonid", "int"), field("pokemonname", "str")]; let id = op.create_schema("POKEMON", "Pokemon schema", &mut fields).await?;
// generate schemaid let schemaid = format!("POKEMON_{}", id);
// create an instance let mut fields = vec![field("pokemonid", "1"), field("pokemonname", "Bulbasaur")]; let instanceid = op.createinstance(&schema_id, &mut fields).await?;
// update the instance let mut fields = vec![field("pokemonname", "Charmander")]; let updateid = op.updateinstance(&schemaid, &instance_id, &mut fields).await?;
// finally delete the instance let deleteid = op.deleteinstance(&schemaid, &update_id).await?; ```