Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cypher] include cumulative tx amount in Lifetime relation #14

Merged
merged 18 commits into from
Jan 28, 2025
Prev Previous commit
Next Next commit
wip dynamic labels
Nora Fitz Coney committed Jan 25, 2025
commit 257035883e5108256bf3a3d7afba0b2b9f6075d2
3 changes: 1 addition & 2 deletions src/cypher_templates.rs
Original file line number Diff line number Diff line change
@@ -55,7 +55,6 @@ MERGE (from:Account {{address: tx.sender}})
MERGE (to:Account {{address: tx.recipient}})

// Dynamically set the relationship label using a subquery
CALL {{
WITH from, to, tx
CALL {{
WITH tx
@@ -66,6 +65,7 @@ CALL {{
ELSE "Unknown" // Default for unexpected or missing values
END AS dynamicLabel
}}
WITH from, to, tx, dynamicLabel
// Use dynamicLabel to create the relationship
MERGE (from)-[rel:`${{dynamicLabel}}` {{tx_hash: tx.tx_hash}}]->(to)
ON CREATE SET
@@ -82,7 +82,6 @@ CALL {{
SET rel += tx.args
)
RETURN rel
}}

// Handle cumulative TotalTx relationships if `tx.amount > 0`
// FOREACH (_ IN CASE WHEN tx.amount > 0 THEN [1] ELSE [] END |
4 changes: 2 additions & 2 deletions tests/test_load_tx.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use anyhow::Result;
use diem_crypto::HashValue;

use libra_forensic_db::{
cypher_templates::{write_batch_tx_string, write_batch_user_create},
cypher_templates::{alt_write_batch_tx_string, write_batch_user_create},
extract_transactions::extract_current_transactions,
load::try_load_one_archive,
load_tx_cypher::tx_batch,
@@ -120,7 +120,7 @@ async fn insert_with_cypher_string() -> Result<()> {

let list_str = WarehouseTxMaster::to_cypher_map(&list);

let cypher_string = write_batch_tx_string(&list_str);
let cypher_string = alt_write_batch_tx_string(&list_str);

let c = start_neo4j_container();
let port = c.get_host_port_ipv4(7687);