#webassembly #wasm #wasmcloud #actor #graph

wasmcloud-actor-graphdb

GraphDB Actor Interface for wasmCloud Actors

4 releases

0.1.3 Apr 16, 2021
0.1.2 Feb 17, 2021
0.1.1 Feb 10, 2021
0.1.0 Feb 10, 2021

#473 in WebAssembly

Download history 2/week @ 2021-05-25 5/week @ 2021-06-01 6/week @ 2021-06-08 3/week @ 2021-06-15 2/week @ 2021-06-22 3/week @ 2021-06-29 2/week @ 2021-07-06 2/week @ 2021-07-13 6/week @ 2021-07-20 11/week @ 2021-07-27 9/week @ 2021-08-03 6/week @ 2021-08-10 4/week @ 2021-08-17 3/week @ 2021-08-24 2/week @ 2021-09-07

51 downloads per month
Used in wasmcloud-redisgraph

Apache-2.0

28KB
530 lines

crates.io  Rust license  documentation

wasmCloud GraphDB Actor Interface

This crate provides an abstraction over the wasmcloud:graphdb contract. This allows actors to interact with a graph database, such as RedisGraph or Neo4j.

Example:

use serde_json::json;
extern crate wapc_guest as guest;
use wasmcloud_actor_graphdb as graph;
use graph::*;
use wasmcloud_actor_http_server as http;
use wasmcloud_actor_core as actor;

use guest::prelude::*;

#[actor::init]
pub fn init() {
    http::Handlers::register_handle_request(handle_http_request);
}

fn handle_http_request(_: http::Request) -> HandlerResult<http::Response> {
    // Replace `query_db` with `graph::default().query_graph()`
    let (name, birth_year): (String, u32) = query_db(
        "MotoGP".to_string(),
        "MATCH (r:Rider)-[:rides]->(t:Team) WHERE t.name = 'Yamaha' RETURN r.name, r.birth_year"
            .to_string(),
    )?;

    assert_eq!(name, "Alice Rider".to_string());
    assert_eq!(birth_year, 1985);

    let result = json!({
        "name": name,
        "birth_year": birth_year
    });

    Ok(http::Response::json(result, 200, "OK"))
}

Dependencies

~1.3–2.1MB
~46K SLoC