Skip to content

Commit

Permalink
Map null property to an empty list/set
Browse files Browse the repository at this point in the history
  • Loading branch information
criminosis committed Apr 9, 2021
1 parent 983183e commit 8346e71
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gremlin-client/src/structure/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ macro_rules! impl_try_from_set {
match value {
GValue::List(s) => for_list_to_set(&s),
GValue::Set(s) => for_set(&s),
GValue::Null => Ok(HashSet::new()),
_ => Err(GremlinError::Cast(format!(
"Cannot cast {:?} to HashSet",
value
Expand All @@ -493,6 +494,7 @@ macro_rules! impl_try_from_set {
match value {
GValue::List(s) => for_list_to_set(&s),
GValue::Set(s) => for_set(&s),
GValue::Null => Ok(HashSet::new()),
_ => Err(GremlinError::Cast(format!(
"Cannot cast {:?} to HashSet",
value
Expand All @@ -508,6 +510,7 @@ macro_rules! impl_try_from_set {
match value {
GValue::List(s) => for_list_to_set(s),
GValue::Set(s) => for_set(s),
GValue::Null => Ok(HashSet::new()),
_ => Err(GremlinError::Cast(format!(
"Cannot cast {:?} to HashSet",
value
Expand Down Expand Up @@ -536,6 +539,7 @@ macro_rules! impl_try_from_list {
fn try_from(value: GValue) -> GremlinResult<Self> {
match value {
GValue::List(s) => for_list(&s),
GValue::Null => Ok(Vec::new()),
_ => Err(GremlinError::Cast(format!(
"Cannot cast {:?} to Vec",
value
Expand All @@ -550,6 +554,7 @@ macro_rules! impl_try_from_list {
fn try_from(value: &GValue) -> GremlinResult<Self> {
match value {
GValue::List(s) => for_list(s),
GValue::Null => Ok(Vec::new()),
_ => Err(GremlinError::Cast(format!(
"Cannot cast {:?} to Vec",
value
Expand Down

0 comments on commit 8346e71

Please sign in to comment.