Arango-DB

 view release on metacpan or  search on metacpan

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

# ABSTRACT: ArangoDB Collection object
package Arango::DB::Collection;
$Arango::DB::Collection::VERSION = '0.006';
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/DB/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/DB/Database.pm  view on Meta::CPAN


package Arango::DB::Database;
$Arango::DB::Database::VERSION = '0.006';
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.018 second using v1.00-cache-1.14-grep-28634ff-cpan-ac32402124b )