DR::Tarantool::Tuple::MsgPack(3pm)

DR::Tarantool::Tuple::MsgPack3pm

A tuple container for dr::tarantool (v >= 1.6)

Usage

    my $tuple = new DR::Tarantool::Tuple::MsgPack::MsgPack([ 1, 2, 3]);
    my $tuple = new DR::Tarantool::Tuple::MsgPack::MsgPack([ 1, 2, 3], $space);
    my $tuple = unpack DR::Tarantool::Tuple::MsgPack::MsgPack([ 1, 2, 3], $space);
    $tuple->next( $other_tuple );
    $f = $tuple->raw(0);
    $f = $tuple->name_field;

Overview

A tuple contains normalized (unpacked) fields. You can access the fields by their indexes (see raw function) or by their names (if they are described in the space).

Each tuple can contain references to next tuple and iterator, so that if the server returns more than one tuple, all of them can be accessed.

Methods

new

A constructor.

    my $t = DR::Tarantool::Tuple::MsgPack->new([1, 2, 3]);
    my $t = DR::Tarantool::Tuple::MsgPack->new([1, 2, 3], $space);

unpack

Another way to construct a tuple.

    my $t = DR::Tarantool::Tuple::MsgPack->unpack([1, 2, 3], $space);

raw

Return raw data from the tuple.

    my $array = $tuple->raw;
    my $field = $tuple->raw(0);

next

Append or return the next tuple, provided there is more than one tuple in the result set.

    my $next_tuple = $tuple->next;

iter

Return an iterator object associated with the tuple.

    my $iterator = $tuple->iter;
    my $iterator = $tuple->iter('MyTupleClass', 'new');
    while(my $t = $iterator->next) {
        # the first value of $t and $tuple are the same
        ...
    }

Arguments

package (optional)
method (optional)

If 'package' and 'method' are present, $iterator->next method constructs objects using "$package->$method( $next_tuple )"

If 'method' is not present and 'package' is present, the iterator blesses the raw array with 'package'.

tail

Return the tail of the tuple (array of unnamed fields). The function always returns ARRAYREF (as raw).

VCS

The project is placed git repo on github: <https://github.com/dr-co/dr-tarantool/>.

Releases

2 releases since Debian 9 (Stretch); the text changed 1 time.

  1. 9
  2. 10

From libdr-tarantool-perl 0.45-2+b2 in Debian 10 (Buster). Parsed by carta from the page's man source.