FalkorDB/Node.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 48 CC 4 SCAR 21.5
CC
4
Cov
0%
new_from_resp
20.0
new
2.0
id
2.0
CRAP 8.5
1 package FalkorDB::Node;
2  
3 use strict;
4 use warnings;
5  
6 sub new {
7 my ( $class, %args ) = @_;
8 return bless \%args, $class;
9 }
10  
11 sub id { shift->{id} }
12 sub labels { shift->{labels} }
13 sub properties { shift->{properties} }
14  
15 sub property {
16 my ( $self, $key ) = @_;
17 return $self->{properties}->{$key};
18 }
19  
20 sub new_from_resp {
21 my ( $class, $resp ) = @_;
22 my ( $id, $labels, $properties );
23  
24 for my $pair (@$resp) {
25 my ( $k, $v ) = @$pair;
26 if ( $k eq 'id' ) {
27 $id = $v;
28 }
29 elsif ( $k eq 'labels' ) {
30 $labels = $v;
31 }
32 elsif ( $k eq 'properties' ) {
33 $properties = FalkorDB::QueryResult::_parse_properties($v);
34 }
35 }
36  
37 return $class->new(
38 id => $id,
39 labels => $labels || [],
40 properties => $properties || {},
41 );
42 }
43  
44 1;
45 __END__