Skip to content

Commit

Permalink
add support for Map argument
Browse files Browse the repository at this point in the history
  • Loading branch information
gkorland committed Sep 16, 2024
1 parent b3efd1d commit 78922bc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/falkordb/impl/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ private static String valueToString(Object value) {
List<Object> list = (List<Object>) value;
return arrayToString(list.toArray());
}

if(value instanceof Map){
@SuppressWarnings("unchecked")
Map<Object, Object> map = (Map<Object, Object>) value;
StringBuilder sb = new StringBuilder().append('{');

Check warning on line 91 in src/main/java/com/falkordb/impl/Utils.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/falkordb/impl/Utils.java#L90-L91

Added lines #L90 - L91 were not covered by tests
for(Map.Entry<Object, Object> entry : map.entrySet()) {
sb.append(valueToString(entry.getKey())).append(':').append(valueToString(entry.getValue())).append(",");
}

Check warning on line 94 in src/main/java/com/falkordb/impl/Utils.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/falkordb/impl/Utils.java#L93-L94

Added lines #L93 - L94 were not covered by tests
// remove last comma
if(sb.length() > 1) {
sb.setLength(sb.length() - 1);

Check warning on line 97 in src/main/java/com/falkordb/impl/Utils.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/falkordb/impl/Utils.java#L97

Added line #L97 was not covered by tests
}
sb.append('}');
return sb.toString();

Check warning on line 100 in src/main/java/com/falkordb/impl/Utils.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/falkordb/impl/Utils.java#L99-L100

Added lines #L99 - L100 were not covered by tests
}

return value.toString();
}

Expand Down

0 comments on commit 78922bc

Please sign in to comment.