Provided by: libdr-tarantool-perl_0.44-1build1_amd64 bug

NAME

       DR::Tarantool::Spaces - Tarantool schema description

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',
                           },
                           {
                               name    => 'opts',
                               type    => 'JSON',
                           }
                       ],
                       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', 3, 10);             # the same
           my $f = $s->pack_field(1, 3, 10);                   # the same

           my $ts = $s->pack_keys([1,2,3] => 'my_idx');
           my $t = $s->pack_primary_key([1,2,3]);

DESCRIPTION

       The package describes all spaces used in an application.  It supports the following field
       types:

       NUM, NUM64, STR
           The standard Tarantool <http://tarantool.org> types.

       UTF8STR
           The same as STR, but the string is utf8-decoded after it's received from the server.

       INT & INT64
           The same as NUM and NUM64, but contain signed values.

       JSON
           The field is encoded with JSON::XS when putting into a database, and decoded after is
           received back from the server.

METHODS

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

   space
       Return space object by number or name.

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

   space_number
       Return space number by its name.

   pack_field
       Packs one field into a format suitable for making a database request:

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

   unpack_field
       Unpack one field after getting it from the server:

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

   pack_tuple
       Pack a tuple before making database request.

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

   unpack_tuple
       Unpack a tuple after getting it from the database:

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

SPACES methods

   new
       constructor

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

   tuple_class
       Create (or return) a class to hold tuple data.  The class is a descendant of
       DR::Tarantool::Tuple. Returns a unique class (package) name. If a package with such name
       is already exists, the method doesn't recreate it.

   name
       Get a space name.

   number
       Get a space number.

   field_number
       Return field index by field name.

   tail_index
       Return index of the first element that is not described in the space.

   pack_field
       Pack a field before making a database request.

   unpack_field
       Unpack a single field in a server response.

   pack_tuple
       Pack a tuple to the binary protocol format:

   unpack_tuple
       Unpack a tuple in a server response.

   index_number
       returns index number by its name.

   index_name
       returns index name by its number.

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/dr-co/dr-tarantool/>.