The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DR::Tarantool::Spaces - spaces container

SYNOPSIS

    use DR::Tarantool::Spaces;
    my $s = new DR::Tarantool::Spaces({
            1   => {
                name            => 'users',         # space name
                default_type    => 'STR',           # undescribed fields
                fields  => [
                    qw(login password role),
                    {
                        name    => 'counter',
                        type    => 'NUM'
                    },
                    {
                        name    => 'something',
                        type    => 'UTF8STR',
                    }
                ],
                indexes => {
                    0   => 'login',
                    1   => [ qw(login password) ],
                    2   => {
                        name    => 'my_idx',
                        fields  => 'login',
                    },
                    3   => {
                        name    => 'my_idx2',
                        fields  => [ 'counter', 'something' ]
                    }
                }
            },

            0 => {
                ...
            }
    });

    my $f = $s->pack_field('users', 'counter', 10);
    my $f = $s->pack_field('users', 1, 10);             # the same
    my $f = $s->pack_field(1, 1, 10);                   # the same

METHODS

new

    my $spaces = DR::Tarantool::Spaces->new( $spaces );

space

Returns space object by number or name.

    my $space = $spaces->space('name');
    my $space = $spaces->space(0);

pack_field

packs one field before making database request

    my $field = $spaces->pack_field('space', 'field', $data);

unpack_field

unpacks one field after extracting data from database

    my $field = $spaces->unpack_field('space', 'field', $data);

pack_tuple

packs tuple before making database request

    my $t = $spaces->pack_tuple('space', [ 1, 2, 3 ]);

unpack_tuple

unpacks tuple after extracting data from database

    my $t = $spaces->unpack_tuple('space', \@fields);

SPACES methods

new

constructor

    use DR::Tarantool::Spaces;
    my $space = DR::Tarantool::Space->new($no, $space);

name

returns space name

number

returns space number

pack_field

packs field before making database request

unpack_field

unpacks field after extracting data from database

pack_tuple

packs tuple before making database request

unpack_tuple

unpacks tuple after extracting data from database

COPYRIGHT AND LICENSE

 Copyright (C) 2011 Dmitry E. Oboukhov <unera@debian.org>
 Copyright (C) 2011 Roman V. Nikolaev <rshadow@rambler.ru>

 This program is free software, you can redistribute it and/or
 modify it under the terms of the Artistic License.

VCS

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