Skip to content

Instantly share code, notes, and snippets.

@vzarytovskii
Created June 22, 2012 15:05
Show Gist options
  • Select an option

  • Save vzarytovskii/2973320 to your computer and use it in GitHub Desktop.

Select an option

Save vzarytovskii/2973320 to your computer and use it in GitHub Desktop.
#!perl
use warnings;
use strict;
use MR::Tarantool::Box;
my $params = {
account => '[email protected]',
application => 'mail',
platform => 'android',
token => 'TEST',
settings => '{}',
status => 0
};
my $box = MR::Tarantool::Box->new({
servers => "127.0.0.1:33013",
name => "My Box", # mostly used for debug purposes
spaces => [ {
indexes => [
{
id => 0,
index_name => 'uniq_idx',
keys => [7]
},{
id => 1,
index_name => 'account_idx',
keys => [1],
},{
id => 2,
index_name => 'token_idx',
keys => [3],
},{
id => 3,
index_name => 'status_idx',
keys => [6],
}
],
space => 1,
name => 'pn_token',
format => '&&&&&ll&',
default_index => 1,
fields => [ qw/account platform application token settings count status pk/ ]
});
sub set_settings {
my $self = shift;
my $params = shift;
my $dbh = $self->_get_dbh();
my $uniq = $params->{platform}.$params->{account}.$params->{application}.$params->{token};
my $result = $dbh->Insert($params->{account},$params->{platform},$params->{application},$params->{token},$params->{settings},$params->{count}, $params->{status},$uniq, {space=>'pn_token'})|| die $!;
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment