Arango-Tango

 view release on metacpan or  search on metacpan

lib/Arango/Tango/Collection.pm  view on Meta::CPAN

            inject_properties => [ 'database', 'name' ],
        },

    };
}



sub _new {
    my ($class, %opts) = @_;
    return bless {%opts} => $class;
}

sub document_paths {
    my ($self) = @_;
    return $self->{arango}->_api( all_keys => { database => $self->{database}, collection => $self->{name}, type => "path"})->{result}
}

sub create_document {
    my ($self, $body) = @_;
    die "Arango::Tango | Refusing to store undefined body" unless defined($body);

lib/Arango/Tango/Collection.pm~  view on Meta::CPAN

# ABSTRACT: ArangoDB Collection object
package Arango::DB::Collection;

use warnings;
use strict;

sub _new {
    my ($class, %opts) = @_;
    return bless {%opts} => $class;
}

sub create_document {
    my ($self, $body) = @_;
    die "Arango::DB | Refusing to store undefined body" unless defined($body);
    return $self->{arango}->_api('create_document', { database => $self->{database}, collection => $self->{name}, body => $body})
}

sub document_paths {
    my ($self) = @_;

lib/Arango/Tango/Cursor.pm  view on Meta::CPAN

use strict;

use Data::Dumper;

sub _new {
  my ($class, %opts) = @_;
  my $self = { arango => $opts{arango}, database => $opts{database} };

  my $ans = $self->{arango}->_api('create_cursor', \%opts);

  return bless { %$ans, %$self, __current => 0 } => $class;
}

sub next {
  my $self = shift;

  if (!$self->{error} && $self->{__current} == 0) {
    $self->{__current}++;
    return $self->{result};
  }

lib/Arango/Tango/Cursor.pm~  view on Meta::CPAN

use strict;

use Data::Dumper;

sub _new {
  my ($class, %opts) = @_;
  my $self = { arango => $opts{arango}, database => $opts{database} };

  my $ans = $self->{arango}->_api('create_cursor', \%opts);

  return bless { %$ans, %$self, __current => 0 } => $class;
}

sub next {
  my $self = shift;

  if (!$self->{error} && $self->{__current} == 0) {
    $self->{__current}++;
    return $self->{result};
  }

lib/Arango/Tango/Database.pm  view on Meta::CPAN

            },
            signature => [ 'name' ],
            inject_properties => [ { prop => 'name', as => 'database' } ]
        }

    };
}

sub _new {
    my ($class, %opts) = @_;
    return bless {%opts} => $class;
}

sub delete {
    my $self = shift;
    return $self->{arango}->delete_database($self->{name});
}

sub cursor {
    my ($self, $aql, %opts) = @_;
    return Arango::Tango::Cursor->_new(arango => $self->{arango}, database => $self->{name}, query => $aql, %opts);

lib/Arango/Tango/Database.pm~  view on Meta::CPAN


package Arango::DB::Database;

use Arango::DB::Cursor;

use warnings;
use strict;

sub _new {
    my ($class, %opts) = @_;
    return bless {%opts} => $class;
}

sub collection {
   my ($self, $name) = @_;
   my @match = grep { $_->{name} eq $name } @{$self->list_collections};
   if (scalar(@match)) {
      return Arango::DB::Collection->_new(arango => $self->{arango}, database => $self->{name}, 'name' => $name);
   }
   else {
      die "Arango::DB | Collection not found in database $self->{name}."

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.182 second using v1.00-cache-1.14-grep-28634ff-cpan-ac32402124b )