File Coverage

blib/lib/FalkorDB/Edge.pm
Criterion Covered Total %
statement 6 26 23.0
branch 0 10 0.0
condition 0 2 0.0
subroutine 2 10 20.0
pod 6 8 75.0
total 14 56 25.0


line stmt bran cond sub pod time code
1             package FalkorDB::Edge;
2              
3 6     6   32 use strict;
  6         10  
  6         200  
4 6     6   23 use warnings;
  6         8  
  6         1764  
5              
6             sub new {
7 0     0 0   my ( $class, %args ) = @_;
8 0           return bless \%args, $class;
9             }
10              
11 0     0 1   sub id { shift->{id} }
12 0     0 1   sub type { shift->{type} }
13 0     0 1   sub src_node { shift->{src_node} }
14 0     0 1   sub dest_node { shift->{dest_node} }
15 0     0 1   sub properties { shift->{properties} }
16              
17             sub property {
18 0     0 1   my ( $self, $key ) = @_;
19 0           return $self->{properties}->{$key};
20             }
21              
22             sub new_from_resp {
23 0     0 0   my ( $class, $resp ) = @_;
24 0           my ( $id, $type, $src_node, $dest_node, $properties );
25              
26 0           for my $pair (@$resp) {
27 0           my ( $k, $v ) = @$pair;
28 0 0         if ( $k eq 'id' ) {
    0          
    0          
    0          
    0          
29 0           $id = $v;
30             }
31             elsif ( $k eq 'type' ) {
32 0           $type = $v;
33             }
34             elsif ( $k eq 'src_node' ) {
35 0           $src_node = $v;
36             }
37             elsif ( $k eq 'dest_node' ) {
38 0           $dest_node = $v;
39             }
40             elsif ( $k eq 'properties' ) {
41 0           $properties = FalkorDB::QueryResult::_parse_properties($v);
42             }
43             }
44              
45 0   0       return $class->new(
46             id => $id,
47             type => $type,
48             src_node => $src_node,
49             dest_node => $dest_node,
50             properties => $properties || {},
51             );
52             }
53              
54             1;
55             __END__