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 ```
Inside main.rs
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 env variable, if unset it uses http://localhost:2020/graphql
as default endpoint
Once aquadoggo
is running. Run the following to test Zenode
:
sh
cargo test
```rs // create an Operator let op = Operator::default();
let mut fields = vec![("pokemonid", "int"), ("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![("pokemonid", "1"), ("pokemonname", "Bulbasaur")]; let instanceid = op.createinstance(&schema_id, &mut fields).await?;
// update instance let mut fields = vec![("pokemonname", "Charmander")]; let updateid = op.updateinstance(&schemaid, &instance_id, &mut fields)await?;
// finally delete instance let deleteid = op.deleteinstance(&schemaid, &update_id).await?; ```