Nano::Nodes

Persistable Index

Persistable Index Super Class

method: add method: all method: count method: drop method: first method: get method: last method: order method: scope method: search method: serialize method: set

use Nano::Nodes;

my $nodes = Nano::Nodes->new(
  type => 'Nano::Node',
);

# $nodes->save;

Nano::Types

Nano::Node

orders: ro, opt, ArrayRef[CodeRef] scopes: ro, opt, ArrayRef[CodeRef] type: ro, req, Str

This package provides a persistable index super class. It is meant to be subclassed but can be used directly as well.

The add method creates a new object, adds it to the index, and returns the created object.

add(HashRef $data) : Object

=example-1 add

# given: synopsis

my $node = $nodes->add({ rand => time });

The all method proxies to the attached Nano::Search instance and returns the results.

all() : ArrayRef[Object]

=example-1 all

# given: synopsis

my $all = $nodes->all;

The count method proxies to the attached Nano::Search instance and returns the results.

count() : Int

=example-1 count

# given: synopsis

my $count = $nodes->count;

The drop method deletes the entire index and all of its indices.

drop() : Object

=example-1 drop

# given: synopsis

$nodes = $nodes->drop;

The first method proxies to the attached Nano::Search instance and returns the result.

first() : Maybe[Object]

=example-1 first

# given: synopsis

my $first = $nodes->first;

The get method returns the object (based on ID) from the index (if found).

get(Str $name) : Maybe[Object]

=example-1 get

# given: synopsis

my $result = $nodes->get('0000001');

The last method proxies to the attached Nano::Search instance and returns the result.

last() : Maybe[Object]

=example-1 last

# given: synopsis

my $last = $nodes->last;

The next method proxies to the attached Nano::Search instance and returns the result.

next() : Maybe[Object]

=example-1 next

# given: synopsis

my $next = $nodes->next;

The prev method proxies to the attached Nano::Search instance and returns the result.

prev() : Maybe[Object]

=example-1 prev

# given: synopsis

my $prev = $nodes->prev;

The order method registers a sort order (search ordering) and returns a new invocant instance.

order(CodeRef $callback) : Object

=example-1 order

# given: synopsis

$nodes = $nodes->order(sub {
  my ($a, $b) = @_;

  $a->id cmp $b->id
});

The scope method registers a scope (search filter) and returns a new invocant instance.

scope(CodeRef $callback) : Object

=example-1 scope

# given: synopsis

$nodes = $nodes->scope(sub {
  my ($node) = @_;

  !!$node->{active}
});

The search method returns a Nano::Search object associated with the invocant.

search() : Search

=example-1 search

# given: synopsis

my $search = $nodes->search;

The serialize method returns a persistence representaton of the invocant. Circular dependencies can result in a deep recursion error, however, circular dependencies can be persisted if modeled properly. Note: blessed objects which are neither Nano::Node nor Nano::Nodes will be ignored.

serialize() : HashRef

=example-1 serialize

# given: synopsis

my $serial = $nodes->serialize;

The set method adds the node object provided to the index and returns the provided object.

set(Node $object) : Object

=example-1 set

# given: synopsis

use Nano::Node;

my $node = Nano::Node->new(id => '0000003');

$node = $nodes->set($node);

37 POD Errors

The following errors were encountered while parsing the POD:

Around line 10:

Unknown directive: =name

Around line 16:

Unknown directive: =tagline

Around line 22:

Unknown directive: =abstract

Around line 28:

Unknown directive: =includes

Around line 45:

Unknown directive: =synopsis

Around line 57:

Unknown directive: =libraries

Around line 63:

Unknown directive: =inherits

Around line 69:

Unknown directive: =attributes

Around line 77:

Unknown directive: =description

Around line 84:

Unknown directive: =method

Around line 89:

Unknown directive: =signature

Around line 101:

Unknown directive: =method

Around line 106:

Unknown directive: =signature

Around line 118:

Unknown directive: =method

Around line 123:

Unknown directive: =signature

Around line 135:

Unknown directive: =method

Around line 139:

Unknown directive: =signature

Around line 151:

Unknown directive: =method

Around line 156:

Unknown directive: =signature

Around line 168:

Unknown directive: =method

Around line 172:

Unknown directive: =signature

Around line 184:

Unknown directive: =method

Around line 189:

Unknown directive: =signature

Around line 201:

Unknown directive: =method

Around line 206:

Unknown directive: =signature

Around line 218:

Unknown directive: =method

Around line 223:

Unknown directive: =signature

Around line 235:

Unknown directive: =method

Around line 240:

Unknown directive: =signature

Around line 256:

Unknown directive: =method

Around line 261:

Unknown directive: =signature

Around line 277:

Unknown directive: =method

Around line 281:

Unknown directive: =signature

Around line 293:

Unknown directive: =method

Around line 300:

Unknown directive: =signature

Around line 312:

Unknown directive: =method

Around line 317:

Unknown directive: =signature