Skip to content

Commit

Permalink
Implemented From<HashMap<GKey, GValue>> for MergeVertexStep to suppor…
Browse files Browse the repository at this point in the history
…t literal maps being defined for mergeV steps
  • Loading branch information
criminosis committed Jul 11, 2024
1 parent 5ec7c71 commit 7cf15cd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gremlin-client/src/process/traversal/step/merge_vertex.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use std::collections::HashMap;

use crate::process::traversal::TraversalBuilder;
use crate::structure::GValue;
use crate::GKey;

pub struct MergeVertexStep {
params: Vec<GValue>,
Expand All @@ -11,8 +14,6 @@ impl MergeVertexStep {
}
}

//todo need to handle (Map<Object,​Object> searchCreate)?
//https://tinkerpop.apache.org/docs/current/dev/provider/#merge-v-step
impl From<MergeVertexStep> for Vec<GValue> {
fn from(step: MergeVertexStep) -> Self {
step.params
Expand All @@ -24,3 +25,9 @@ impl From<TraversalBuilder> for MergeVertexStep {
MergeVertexStep::new(vec![param.bytecode.into()])
}
}

impl From<HashMap<GKey, GValue>> for MergeVertexStep {
fn from(value: HashMap<GKey, GValue>) -> Self {
MergeVertexStep::new(vec![value.into()])
}
}

0 comments on commit 7cf15cd

Please sign in to comment.